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

Re: Unnecessary subpool creation

From: Yoshiki Hayashi <yoshiki_at_xemacs.org>
Date: 2002-01-28 12:09:42 CET

Yoshiki Hayashi <yoshiki@xemacs.org> writes:

> For those two, the life time of subpool is exactly the same
> as the parent pool. When I first saw it, I thought it was a
> bug and looked abort_txn and commit_txn in trail.c. And I
> found from commetn at commit_txn it is an intentional
> behavior. I'd suggest removing those two subpool creation
> but I don't know why it's done that way. Are there only
> historical reasons?

Never mind trail.c part. It was destroyed when abort_trail
is called.

There is another update of issue #602. I found one more
place where Subversion is using memory linear to the size of
tree.

It's in stabilize node. When it recursively stabilize
nodes, it uses the same trail which effectively means the
same pool. I made a tentative patch to create subpool.
This patch is not intended to be committed as is as I'm not
sure subtrail part is doing the right thing. But this patch
allowd me to proceed further in importing large tree and
shows what needs to be done.

* dag.c (stabilize_node): Create subtrail which has new
  subpool and use it for recursive call.

Index: ./subversion/libsvn_fs/dag.c
===================================================================
--- ./subversion/libsvn_fs/dag.c
+++ ./subversion/libsvn_fs/dag.c Sat Jan 26 12:06:15 2002
@@ -1805,10 +1805,14 @@
     {
       if (svn_fs__dag_is_directory (node))
         {
+ trail_t *subtrail = apr_palloc (trail->pool, sizeof (trail_t));
           skel_t *entries;
           skel_t *entry;
-
- SVN_ERR (svn_fs__dag_dir_entries_skel (&entries, node, trail));
+
+ memcpy (subtrail, trail, sizeof (trail_t));
+ subtrail->pool = svn_pool_create (trail->pool);
+
+ SVN_ERR (svn_fs__dag_dir_entries_skel (&entries, node, subtrail));
           
           /* Each entry looks like (NAME ID). */
           for (entry = entries->children; entry; entry = entry->next)
@@ -1816,11 +1820,12 @@
               dag_node_t *child;
               skel_t *id_skel = entry->children->next;
               svn_fs_id_t *id
- = svn_fs_parse_id (id_skel->data, id_skel->len, trail->pool);
+ = svn_fs_parse_id (id_skel->data, id_skel->len, subtrail->pool);
               
- SVN_ERR (svn_fs__dag_get_node (&child, node->fs, id, trail));
- SVN_ERR (stabilize_node (child, rev, trail));
+ SVN_ERR (svn_fs__dag_get_node (&child, node->fs, id, subtrail));
+ SVN_ERR (stabilize_node (child, rev, subtrail));
             }
+ svn_pool_destroy (subtrail->pool);
         }
       else if (svn_fs__dag_is_file (node))
         ;

-- 
Yoshiki Hayashi
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:37:00 2006

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.