subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1776788 - /subversion/trunk/subversion/libsvn_client/merge.c
Date Sat, 31 Dec 2016 15:55:33 GMT
Author: julianfoad
Date: Sat Dec 31 15:55:32 2016
New Revision: 1776788

URL: http://svn.apache.org/viewvc?rev=1776788&view=rev
Log:
Reduce memory usage of merge by using a subpool for temporary mergeinfo.

In my test case this reduced the total memory usage (RSS on Linux) of the
process e.g. from baseline 8 MB + growth of 50 MB to baseline 8 MB + growth
of 43 MB.

My test case created 300 branches, each with a small change to a different
file, merged all of them to trunk in such a way that trunk ended up with a
lot of subtree mergeinfo (300 files with mergeinfo, 300 branches mentioned
in each one's mergeinfo), and then monitored the memory usage of an
automatic merge from trunk to the first branch.

* subversion/libsvn_client/merge.c
  (get_mergeinfo_paths): Use a subpool for temporary mergeinfo.

Modified:
    subversion/trunk/subversion/libsvn_client/merge.c

Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1776788&r1=1776787&r2=1776788&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Sat Dec 31 15:55:32 2016
@@ -6425,6 +6425,7 @@ get_mergeinfo_paths(apr_array_header_t *
 {
   int i;
   apr_pool_t *iterpool = svn_pool_create(scratch_pool);
+  apr_pool_t *swmi_pool;
   apr_hash_t *subtrees_with_mergeinfo;
   apr_hash_t *excluded_subtrees;
   apr_hash_t *switched_subtrees;
@@ -6433,10 +6434,13 @@ get_mergeinfo_paths(apr_array_header_t *
   struct pre_merge_status_baton_t pre_merge_status_baton;
 
   /* Case 1: Subtrees with explicit mergeinfo. */
+  /* Use a subpool for subtrees_with_mergeinfo, as it can be very large
+     and is temporary. */
+  swmi_pool = svn_pool_create(scratch_pool);
   SVN_ERR(get_wc_explicit_mergeinfo_catalog(&subtrees_with_mergeinfo,
                                             target->abspath,
                                             depth, ctx,
-                                            result_pool, scratch_pool));
+                                            swmi_pool, swmi_pool));
   if (subtrees_with_mergeinfo)
     {
       apr_hash_index_t *hi;
@@ -6470,6 +6474,7 @@ get_mergeinfo_paths(apr_array_header_t *
          children with insert_child_to_merge() require this ordering. */
       svn_sort__array(children_with_mergeinfo, compare_merge_path_t_as_paths);
     }
+  svn_pool_destroy(swmi_pool);
 
   /* Case 2: Switched subtrees
      Case 10: Paths at depths of 'empty' or 'files'



Mime
View raw message