Return-Path: X-Original-To: apmail-subversion-commits-archive@minotaur.apache.org Delivered-To: apmail-subversion-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9196E18859 for ; Mon, 18 Jan 2016 08:07:33 +0000 (UTC) Received: (qmail 69141 invoked by uid 500); 18 Jan 2016 08:07:33 -0000 Delivered-To: apmail-subversion-commits-archive@subversion.apache.org Received: (qmail 69101 invoked by uid 500); 18 Jan 2016 08:07:33 -0000 Mailing-List: contact commits-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@subversion.apache.org Delivered-To: mailing list commits@subversion.apache.org Received: (qmail 69091 invoked by uid 99); 18 Jan 2016 08:07:33 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Jan 2016 08:07:33 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id E883B1A04A5 for ; Mon, 18 Jan 2016 08:07:32 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.446 X-Spam-Level: X-Spam-Status: No, score=0.446 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-0.554] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id zpBpWFQuboXU for ; Mon, 18 Jan 2016 08:07:32 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTP id 8315B23016 for ; Mon, 18 Jan 2016 08:07:31 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id A1F83E00B0 for ; Mon, 18 Jan 2016 08:07:30 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 60D4D3A0056 for ; Mon, 18 Jan 2016 08:07:30 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1725180 - /subversion/trunk/subversion/libsvn_fs_fs/cached_data.c Date: Mon, 18 Jan 2016 08:07:30 -0000 To: commits@subversion.apache.org From: stefan2@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20160118080730.60D4D3A0056@svn01-us-west.apache.org> Author: stefan2 Date: Mon Jan 18 08:07:30 2016 New Revision: 1725180 URL: http://svn.apache.org/viewvc?rev=1725180&view=rev Log: Reduce peak memory footprint for very large directories in FSFS. * subversion/libsvn_fs_fs/cached_data.c (svn_fs_fs__rep_contents_dir, svn_fs_fs__rep_contents_dir_entry): Don't serialize directories that won't fit into the cache. Modified: subversion/trunk/subversion/libsvn_fs_fs/cached_data.c Modified: subversion/trunk/subversion/libsvn_fs_fs/cached_data.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/cached_data.c?rev=1725180&r1=1725179&r2=1725180&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_fs_fs/cached_data.c (original) +++ subversion/trunk/subversion/libsvn_fs_fs/cached_data.c Mon Jan 18 08:07:30 2016 @@ -2715,8 +2715,12 @@ svn_fs_fs__rep_contents_dir(apr_array_he SVN_ERR(get_dir_contents(dir, fs, noderev, result_pool, scratch_pool)); *entries_p = dir->entries; - /* Update the cache, if we are to use one. */ - if (cache) + /* Update the cache, if we are to use one. + * + * Don't even attempt to serialize very large directories; it would cause + * an unnecessary memory allocation peak. 150 bytes/entry is about right. + */ + if (cache && svn_cache__is_cachable(cache, 150 * dir->entries->nelts)) SVN_ERR(svn_cache__set(cache, key, dir, scratch_pool)); return SVN_NO_ERROR; @@ -2777,8 +2781,12 @@ svn_fs_fs__rep_contents_dir_entry(svn_fs SVN_ERR(get_dir_contents(&dir, fs, noderev, scratch_pool, scratch_pool)); - /* Update the cache, if we are to use one. */ - if (cache) + /* Update the cache, if we are to use one. + * + * Don't even attempt to serialize very large directories; it would + * cause an unnecessary memory allocation peak. 150 bytes / entry is + * about right. */ + if (cache && svn_cache__is_cachable(cache, 150 * dir.entries->nelts)) SVN_ERR(svn_cache__set(cache, key, &dir, scratch_pool)); /* find desired entry and return a copy in POOL, if found */