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

[PATCH] svn status can use huge amounts of memory

From: Robert Pluim <rpluim_at_bigfoot.com>
Date: 2003-02-23 14:28:01 CET

Hi,

I have a working copy dir in which I have added a large number of
files (~5000).

`svn status' in that directory works fine, but `svn status [list]'
chews up huge amounts of memory, mainly because the entries file is
reparsed (twice) for every single file in the list, and the memory
used for that is never freed. The attached patch fixes that for me (a
better fix might be to keep the previously parsed entries file around,
but I wasn't quite sure where to cache that).

Robert

* svn/subversion/clients/cmdline/status-cmd.c (svn_cl__status): Use
  and clear a subpool when iterating. This reduces memory usage
  enormously.

Index: clients/cmdline/status-cmd.c
===================================================================
--- clients/cmdline/status-cmd.c (revision 5004)
+++ clients/cmdline/status-cmd.c (working copy)
@@ -28,6 +28,7 @@
 #include "svn_path.h"
 #include "svn_delta.h"
 #include "svn_error.h"
+#include "svn_pools.h"
 #include "cl.h"
 
 
@@ -43,6 +44,7 @@
   svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx;
   apr_hash_t *statushash;
   apr_array_header_t *targets;
+ apr_pool_t * subpool;
   int i;
   svn_revnum_t youngest = SVN_INVALID_REVNUM;
 
@@ -59,6 +61,8 @@
   /* Add "." if user passed 0 arguments */
   svn_opt_push_implicit_dot_target(targets, pool);
 
+ subpool = svn_pool_create (pool);
+
   for (i = 0; i < targets->nelts; i++)
     {
       const char *target = ((const char **) (targets->elts))[i];
@@ -74,7 +78,7 @@
                                   opt_state->verbose,
                                   opt_state->update,
                                   opt_state->no_ignore,
- ctx, pool));
+ ctx, subpool));
 
       /* Now print the structures to the screen.
          The flag we pass indicates whether to use the 'detailed'
@@ -84,8 +88,11 @@
                                  (opt_state->verbose || opt_state->update),
                                  opt_state->verbose,
                                  opt_state->quiet,
- pool);
+ subpool);
+ svn_pool_clear (subpool);
     }
 
+ svn_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 Feb 23 15:11:22 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.