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

Re: [PATCH] Fix svn_io_remove_dir pool usage

From: <kfogel_at_collab.net>
Date: 2004-11-01 17:22:21 CET

Eric Gillespie <epg@pretzelnet.org> writes:
> This passes the smoke test of allowing my massive import. If it
> passes the test suite and no one objects, i'll commit this.
>
> Memory usage for svn_io_remove_dir was going through the roof when
> removing a large directory (e.g. bumping into a 128 MB resource limit
> in svn_fs_fs__purge_txn when committing 89482 files). Fix its pool
> usage to avoid this.

It looks good to me. I'm kind of surprised we weren't doing it
before, actually.

You might want to move the subpool allocation to right before the
for-loop, and its destruction to right after the for-loop, so it's
clear that its scope is just the loop.

-Karl

> * subversion/libsvn_subr/io.c
> (svn_io_remove_dir): Allocate path_apr and this_dir directly in the
> input pool instead of the subpool. Use subpool instead of pool in
> the loop, clearing it on each iteration.
>
> Index: subversion/libsvn_subr/io.c
> ===================================================================
> --- subversion/libsvn_subr/io.c (revision 11677)
> +++ subversion/libsvn_subr/io.c (working copy)
> @@ -1445,9 +1445,9 @@
> instead of just using svn_io_dir_open, because we're going to
> need path_apr later anyway when we remove the dir itself. */
>
> - SVN_ERR (svn_path_cstring_from_utf8 (&path_apr, path, subpool));
> + SVN_ERR (svn_path_cstring_from_utf8 (&path_apr, path, pool));
>
> - status = apr_dir_open (&this_dir, path_apr, subpool);
> + status = apr_dir_open (&this_dir, path_apr, pool);
> if (status)
> return svn_error_wrap_apr (status, _("Can't open directory '%s'"), path);
>
> @@ -1455,6 +1455,7 @@
> status == APR_SUCCESS;
> status = apr_dir_read (&this_entry, flags, this_dir))
> {
> + svn_pool_clear (subpool);
> if ((this_entry.filetype == APR_DIR)
> && ((this_entry.name[0] == '.')
> && ((this_entry.name[1] == '\0')
> @@ -1470,7 +1471,7 @@
> SVN_ERR (svn_path_cstring_to_utf8 (&entry_utf8, this_entry.name,
> subpool));
>
> - fullpath = svn_path_join (path, entry_utf8, pool);
> + fullpath = svn_path_join (path, entry_utf8, subpool);
>
> if (this_entry.filetype == APR_DIR)
> {
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Nov 1 19:16:06 2004

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