You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2016/12/31 13:44:32 UTC
svn commit: r1776742 - /subversion/trunk/subversion/libsvn_client/merge.c
Author: julianfoad
Date: Sat Dec 31 13:44:32 2016
New Revision: 1776742
URL: http://svn.apache.org/viewvc?rev=1776742&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 by about a third, e.g. from baseline 8 MB + growth of 75 MB to
baseline 8 MB + growth of 50 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
(find_last_merged_location): 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=1776742&r1=1776741&r2=1776742&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Sat Dec 31 13:44:32 2016
@@ -12304,6 +12304,10 @@ find_last_merged_location(svn_client__pa
svn_revnum_t youngest_merged_rev = SVN_INVALID_REVNUM;
svn_mergeinfo_catalog_t target_mergeinfo_cat = NULL;
+ /* Use a local subpool. Using this for 'target_mergeinfo_cat' in particular
+ makes a big reduction in overall memory usage. */
+ scratch_pool = svn_pool_create(scratch_pool);
+
source_peg_rev.kind = svn_opt_revision_number;
source_peg_rev.value.number = source_branch->tip->rev;
source_start_rev.kind = svn_opt_revision_number;
@@ -12324,7 +12328,7 @@ find_last_merged_location(svn_client__pa
operative_rev_receiver,
&youngest_merged_rev,
ctx, ra_session,
- result_pool, scratch_pool));
+ scratch_pool, scratch_pool));
if (!SVN_IS_VALID_REVNUM(youngest_merged_rev))
{
@@ -12361,6 +12365,7 @@ find_last_merged_location(svn_client__pa
&oldest_eligible_rev,
ctx, ra_session,
scratch_pool, scratch_pool));
+ svn_pool_clear(scratch_pool);
/* If there are revisions eligible for merging, use the oldest one
to calculate the base. Otherwise there are no operative revisions
@@ -12382,6 +12387,7 @@ find_last_merged_location(svn_client__pa
result_pool, scratch_pool));
}
+ svn_pool_destroy(scratch_pool);
return SVN_NO_ERROR;
}