[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] Multi-target commit memory usage

From: D.J. Heap <dj_at_shadyvale.net>
Date: 2004-03-09 01:02:36 CET

This is essentially a repost of the patch in issue 1635 for excessive
memory usage during multi-target commits. It passes all tests over all
ra layers and significantly reduces memory usage when many targets are
specified with wildcards or scripts or GUI clients of the commit API.

I'm going to try to recreate the other memory problems in that issue
against trunk since I haven't re-tried those for a while and there have
been a number of fixes in that area -- it may be all better now except
for this bit.

Can a core committer approve or comment, please? It's a pretty
straightforward fix.

Log:

Fix an excessive memory usage problem when multiple targets are specified.

* subversion/libsvn_client/commit.c
   (svn_client_commit): Use a subpool in the target-processing loop.

Index: subversion/libsvn_client/commit.c
===================================================================
--- subversion/libsvn_client/commit.c (revision 8939)
+++ subversion/libsvn_client/commit.c (working copy)
@@ -1111,6 +1111,8 @@
     }
   else
     {
+ apr_pool_t *subpool = svn_pool_create (pool);
+
       SVN_ERR (adjust_rel_targets (&base_dir, &rel_targets,
                                    base_dir, rel_targets,
                                    pool));
@@ -1119,19 +1121,20 @@
         {
           const char *parent_dir, *name;
 
+ svn_pool_clear (subpool);
           target = svn_path_join (base_dir,
                                   APR_ARRAY_IDX (rel_targets, i, const char *),
- pool);
+ subpool);
           SVN_ERR (svn_wc_get_actual_target (target, &parent_dir,
- &name, pool));
+ &name, subpool));
 
           if (*name)
             {
               svn_node_kind_t kind;
 
- target = svn_path_join (parent_dir, name, pool);
+ target = svn_path_join (parent_dir, name, subpool);
           
- SVN_ERR (svn_io_check_path (target, &kind, pool));
+ SVN_ERR (svn_io_check_path (target, &kind, subpool));
 
               /* If the final target is a dir, we want to recursively
                  lock it */
@@ -1139,10 +1142,10 @@
                 {
                   if (nonrecursive)
                     APR_ARRAY_PUSH (dirs_to_lock,
- const char *) = target;
+ const char *) = apr_pstrdup (pool, target);
                   else
                     APR_ARRAY_PUSH (dirs_to_lock_recursive,
- const char *) = target;
+ const char *) = apr_pstrdup (pool, target);
                 }
             }
 
@@ -1152,10 +1155,12 @@
               if (target[0] == '/' && target[1] == '\0')
                 abort();
 
- APR_ARRAY_PUSH (dirs_to_lock, const char *) = target;
- target = svn_path_dirname(target, pool);
+ APR_ARRAY_PUSH (dirs_to_lock,
+ const char *) = apr_pstrdup (pool, target);
+ target = svn_path_dirname(target, subpool);
             }
         }
+ svn_pool_destroy (subpool);
     }
 
   SVN_ERR (svn_wc_adm_open (&base_dir_access, NULL, base_dir,

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Mar 9 01:03:07 2004

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.