You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2016/01/18 09:07:30 UTC
svn commit: r1725180 -
/subversion/trunk/subversion/libsvn_fs_fs/cached_data.c
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 */