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

[PATCH] decrease maximum simultaneous svn:externals connections (issue #1448)

From: Josh Pieper <jpieper_at_andrew.cmu.edu>
Date: 2003-10-05 18:51:50 CEST

Here's another bite-sized patch. By moving where the sub-pools are
allocated, the maximum number of simultaneous svn:externals
connections is now a function of the recursion depth, rather than the
total number of linked repositories in the tree. I'm not certain that
this is correct pool usage, as I haven't used apr's pools before.
However, it doesn't segfault or leak more memory, and it passes all
local tests.

-Josh

-------------------------------------

Fix issue #1448: Decrease the number of svn:externals connections
by clearing appropriate subpools after each external operation.

* subversion/libsvn_client/externals.c
  (handle_externals_desc_change, handle_external_item_change):
    Create a subpool for each external that is handled and destroy
    it upon completion.
  (svn_client__do_external_status): Move the created subpool in one
    level, so that it is cleared after each external is checked.

Index: subversion/libsvn_client/externals.c
===================================================================
--- subversion/libsvn_client/externals.c (revision 7308)
+++ subversion/libsvn_client/externals.c (working copy)
@@ -383,6 +383,7 @@
         }
     }
 
+ svn_pool_clear(ib->pool);
   return SVN_NO_ERROR;
 }
 
@@ -434,11 +435,13 @@
   ib.ctx = cb->ctx;
   ib.update_unchanged = cb->update_unchanged;
   ib.timestamp_sleep = cb->timestamp_sleep;
- ib.pool = cb->pool;
+ ib.pool = svn_pool_create(cb->pool);
 
   SVN_ERR (svn_hash_diff (old_desc, new_desc,
                           handle_external_item_change, &ib, cb->pool));
 
+ svn_pool_destroy(ib.pool);
+
   return SVN_NO_ERROR;
 }
 
@@ -481,7 +484,6 @@
 {
   apr_hash_t *externals_old, *externals_new;
   apr_hash_index_t *hi;
- apr_pool_t *subpool = svn_pool_create (pool);
 
   /* Get the values of the svn:externals properties. */
   svn_wc_edited_externals (&externals_old, &externals_new, traversal_info);
@@ -493,6 +495,7 @@
        hi;
        hi = apr_hash_next (hi))
     {
+ apr_pool_t *subpool = svn_pool_create (pool);
       apr_hash_t *exts;
       apr_hash_index_t *hi2;
       const void *key;
@@ -500,9 +503,6 @@
       const char *path;
       const char *propval;
 
- /* Clear the subpool. */
- svn_pool_clear (subpool);
-
       apr_hash_this (hi, &key, NULL, &val);
       path = key;
       propval = val;
@@ -510,10 +510,10 @@
       /* Parse the svn:externals property value. This results in a
          hash mapping subdirectories to externals structures. */
       SVN_ERR (svn_wc_parse_externals_description (&exts, path,
- propval, subpool));
-
+ propval, pool));
+
       /* Loop over the subdir hash. */
- for (hi2 = apr_hash_first (subpool, exts);
+ for (hi2 = apr_hash_first (pool, exts);
            hi2;
            hi2 = apr_hash_next (hi2))
         {
@@ -548,10 +548,13 @@
                                       &(external->revision),
                                       status_func, status_baton,
                                       TRUE, get_all, update, no_ignore,
- ctx, pool));
+ ctx, subpool));
+
+ svn_pool_clear (subpool);
         }
- }
+
+ svn_pool_destroy (subpool);
+ }
   
- apr_pool_destroy (subpool);
   return SVN_NO_ERROR;
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Oct 5 18:52:31 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.