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

Commit memory usage

From: D.J. Heap <dj_at_shadyvale.net>
Date: 2003-12-10 02:45:41 CET

When many targets are specified, svn_client_commit chews through lots of
memory (~500 targets went through ~300MB of memory). The attached patch
introduces a subpool into the offending loop and seems to pass cursory
testing.

Would someone mind reviewing it for correctness? Feel free to
tweak/test/commit if it looks desirable -- I'm going to be slow to
respond for a couple of days.

I'm also investigating some heavy memory use on the server (svnserve)
and client (during update) when hundreds of files are deleted in one
commit, but I haven't repro'd it on HEAD yet -- hopefully by this
weekend I will have details if it repros on HEAD.

DJ

Index: subversion/libsvn_client/commit.c
===================================================================
--- subversion/libsvn_client/commit.c (revision 7968)
+++ subversion/libsvn_client/commit.c (working copy)
@@ -1039,6 +1039,8 @@
     }
   else
     {
+ apr_pool_t *subpool = svn_pool_create (pool);
+
       SVN_ERR (adjust_rel_targets (&base_dir, &rel_targets,
                                    base_dir, rel_targets,
                                    pool));
@@ -1047,19 +1049,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 */
@@ -1067,10 +1070,12 @@
                 {
                   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);
                 }
             }
 
@@ -1080,10 +1085,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 Wed Dec 10 02:46:24 2003

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.