subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1564215 - /subversion/trunk/subversion/libsvn_repos/reporter.c
Date Tue, 04 Feb 2014 06:05:43 GMT
Author: stefan2
Date: Tue Feb  4 06:05:43 2014
New Revision: 1564215

URL: http://svn.apache.org/r1564215
Log:
Tighten pool usage in our standard reporter.

For not so obvious reasons, the pool passed to delta_dirs can take
a long time to get clean up eventually.  As a result, I got dynamic
peaks in memory usage of a whopping 20GB when running extreme tests
like 'svn-bench null-export' on the full kde.org repository.

With this fix, the peak is reduced to 100MB which is reaonably
"streamy" and will be reduced further by following commits.

* subversion/libsvn_repos/reporter.c
  (delta_dirs): Rename the existing subpool to iterpool.
                Create a subpool for all other allocations in this
                function and clean that up asap.

Modified:
    subversion/trunk/subversion/libsvn_repos/reporter.c

Modified: subversion/trunk/subversion/libsvn_repos/reporter.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/reporter.c?rev=1564215&r1=1564214&r2=1564215&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/reporter.c (original)
+++ subversion/trunk/subversion/libsvn_repos/reporter.c Tue Feb  4 06:05:43 2014
@@ -1142,7 +1142,8 @@ delta_dirs(report_baton_t *b, svn_revnum
 {
   apr_hash_t *s_entries = NULL, *t_entries;
   apr_hash_index_t *hi;
-  apr_pool_t *subpool;
+  apr_pool_t *subpool = svn_pool_create(pool);
+  apr_pool_t *iterpool;
   apr_array_header_t *t_ordered_entries = NULL;
   int i;
 
@@ -1151,7 +1152,8 @@ delta_dirs(report_baton_t *b, svn_revnum
 
      When we support directory locks, we must pass the lock token here. */
   SVN_ERR(delta_proplists(b, s_rev, start_empty ? NULL : s_path, t_path,
-                          NULL, change_dir_prop, dir_baton, pool));
+                          NULL, change_dir_prop, dir_baton, subpool));
+  svn_pool_clear(subpool);
 
   if (requested_depth > svn_depth_empty
       || requested_depth == svn_depth_unknown)
@@ -1162,12 +1164,12 @@ delta_dirs(report_baton_t *b, svn_revnum
           svn_fs_root_t *s_root;
 
           SVN_ERR(get_source_root(b, &s_root, s_rev));
-          SVN_ERR(svn_fs_dir_entries(&s_entries, s_root, s_path, pool));
+          SVN_ERR(svn_fs_dir_entries(&s_entries, s_root, s_path, subpool));
         }
-      SVN_ERR(svn_fs_dir_entries(&t_entries, b->t_root, t_path, pool));
+      SVN_ERR(svn_fs_dir_entries(&t_entries, b->t_root, t_path, subpool));
 
       /* Iterate over the report information for this directory. */
-      subpool = svn_pool_create(pool);
+      iterpool = svn_pool_create(pool);
 
       while (1)
         {
@@ -1175,8 +1177,8 @@ delta_dirs(report_baton_t *b, svn_revnum
           const char *name, *s_fullpath, *t_fullpath, *e_fullpath;
           const svn_fs_dirent_t *s_entry, *t_entry;
 
-          svn_pool_clear(subpool);
-          SVN_ERR(fetch_path_info(b, &name, &info, e_path, subpool));
+          svn_pool_clear(iterpool);
+          SVN_ERR(fetch_path_info(b, &name, &info, e_path, iterpool));
           if (!name)
             break;
 
@@ -1196,10 +1198,10 @@ delta_dirs(report_baton_t *b, svn_revnum
               continue;
             }
 
-          e_fullpath = svn_relpath_join(e_path, name, subpool);
-          t_fullpath = svn_fspath__join(t_path, name, subpool);
+          e_fullpath = svn_relpath_join(e_path, name, iterpool);
+          t_fullpath = svn_fspath__join(t_path, name, iterpool);
           t_entry = svn_hash_gets(t_entries, name);
-          s_fullpath = s_path ? svn_fspath__join(s_path, name, subpool) : NULL;
+          s_fullpath = s_path ? svn_fspath__join(s_path, name, iterpool) : NULL;
           s_entry = s_entries ? svn_hash_gets(s_entries, name) : NULL;
 
           /* The only special cases where we don't process the entry are
@@ -1218,7 +1220,7 @@ delta_dirs(report_baton_t *b, svn_revnum
                                  t_entry, dir_baton, e_fullpath, info,
                                  info ? info->depth
                                       : DEPTH_BELOW_HERE(wc_depth),
-                                 DEPTH_BELOW_HERE(requested_depth), subpool));
+                                 DEPTH_BELOW_HERE(requested_depth), iterpool));
 
           /* Don't revisit this name in the target or source entries. */
           svn_hash_sets(t_entries, name, NULL);
@@ -1238,13 +1240,13 @@ delta_dirs(report_baton_t *b, svn_revnum
          target, for graceful handling of case-only renames. */
       if (s_entries)
         {
-          for (hi = apr_hash_first(pool, s_entries);
+          for (hi = apr_hash_first(subpool, s_entries);
                hi;
                hi = apr_hash_next(hi))
             {
               const svn_fs_dirent_t *s_entry = svn__apr_hash_index_val(hi);
 
-              svn_pool_clear(subpool);
+              svn_pool_clear(iterpool);
 
               if (svn_hash_gets(t_entries, s_entry->name) == NULL)
                 {
@@ -1261,24 +1263,24 @@ delta_dirs(report_baton_t *b, svn_revnum
                     continue;
 
                   /* There is no corresponding target entry, so delete. */
-                  e_fullpath = svn_relpath_join(e_path, s_entry->name, subpool);
+                  e_fullpath = svn_relpath_join(e_path, s_entry->name, iterpool);
                   SVN_ERR(svn_repos_deleted_rev(svn_fs_root_fs(b->t_root),
                                                 svn_fspath__join(t_path,
                                                                  s_entry->name,
-                                                                 subpool),
+                                                                 iterpool),
                                                 s_rev, b->t_rev,
-                                                &deleted_rev, subpool));
+                                                &deleted_rev, iterpool));
 
                   SVN_ERR(b->editor->delete_entry(e_fullpath,
                                                   deleted_rev,
-                                                  dir_baton, subpool));
+                                                  dir_baton, iterpool));
                 }
             }
         }
 
       /* Loop over the dirents in the target. */
       SVN_ERR(svn_fs_dir_optimal_order(&t_ordered_entries, b->t_root,
-                                       t_entries, pool));
+                                       t_entries, subpool));
       for (i = 0; i < t_ordered_entries->nelts; ++i)
         {
           const svn_fs_dirent_t *t_entry
@@ -1286,7 +1288,7 @@ delta_dirs(report_baton_t *b, svn_revnum
           const svn_fs_dirent_t *s_entry;
           const char *s_fullpath, *t_fullpath, *e_fullpath;
 
-          svn_pool_clear(subpool);
+          svn_pool_clear(iterpool);
 
           if (is_depth_upgrade(wc_depth, requested_depth, t_entry->kind))
             {
@@ -1311,22 +1313,25 @@ delta_dirs(report_baton_t *b, svn_revnum
               s_entry = s_entries ?
                   svn_hash_gets(s_entries, t_entry->name) : NULL;
               s_fullpath = s_entry ?
-                  svn_fspath__join(s_path, t_entry->name, subpool) : NULL;
+                  svn_fspath__join(s_path, t_entry->name, iterpool) : NULL;
             }
 
           /* Compose the report, editor, and target paths for this entry. */
-          e_fullpath = svn_relpath_join(e_path, t_entry->name, subpool);
-          t_fullpath = svn_fspath__join(t_path, t_entry->name, subpool);
+          e_fullpath = svn_relpath_join(e_path, t_entry->name, iterpool);
+          t_fullpath = svn_fspath__join(t_path, t_entry->name, iterpool);
 
           SVN_ERR(update_entry(b, s_rev, s_fullpath, s_entry, t_fullpath,
                                t_entry, dir_baton, e_fullpath, NULL,
                                DEPTH_BELOW_HERE(wc_depth),
                                DEPTH_BELOW_HERE(requested_depth),
-                               subpool));
+                               iterpool));
         }
 
-      svn_pool_destroy(subpool);
+      svn_pool_destroy(iterpool);
     }
+
+  svn_pool_destroy(subpool);
+
   return SVN_NO_ERROR;
 }
 



Mime
View raw message