You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2015/03/02 21:38:05 UTC

svn commit: r1663422 - /subversion/branches/fsx-1.10/subversion/libsvn_fs_x/transaction.c

Author: stefan2
Date: Mon Mar  2 20:38:05 2015
New Revision: 1663422

URL: http://svn.apache.org/r1663422
Log:
On the fsx-1.10 branch:
Make an FS(X) API call more user friendly by not leaving larger amounts
of data allocated in the user-provided scratch pool.

* subversion/libsvn_fs_x/transaction.c
  (svn_fs_x__purge_txn): Use a SUBPOOL to tighten memory usage.

Modified:
    subversion/branches/fsx-1.10/subversion/libsvn_fs_x/transaction.c

Modified: subversion/branches/fsx-1.10/subversion/libsvn_fs_x/transaction.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_fs_x/transaction.c?rev=1663422&r1=1663421&r2=1663422&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_fs_x/transaction.c (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_fs_x/transaction.c Mon Mar  2 20:38:05 2015
@@ -1685,25 +1685,30 @@ svn_fs_x__purge_txn(svn_fs_t *fs,
                     apr_pool_t *scratch_pool)
 {
   svn_fs_x__txn_id_t txn_id;
+
+  /* The functions we are calling open files and operate on the OS FS.
+     Since these may allocate a non-trivial amount of memory, do that
+     in a SUBPOOL and clear that one up before returning. */
+  apr_pool_t *subpool = svn_pool_create(scratch_pool);
   SVN_ERR(svn_fs_x__txn_by_name(&txn_id, txn_id_str));
 
   /* Remove the shared transaction object associated with this transaction. */
-  SVN_ERR(purge_shared_txn(fs, txn_id, scratch_pool));
+  SVN_ERR(purge_shared_txn(fs, txn_id, subpool));
   /* Remove the directory associated with this transaction. */
-  SVN_ERR(svn_io_remove_dir2(svn_fs_x__path_txn_dir(fs, txn_id, scratch_pool),
-                             FALSE, NULL, NULL, scratch_pool));
+  SVN_ERR(svn_io_remove_dir2(svn_fs_x__path_txn_dir(fs, txn_id, subpool),
+                             FALSE, NULL, NULL, subpool));
 
-  /* Delete protorev and its lock, which aren't in the txn
-      directory.  It's OK if they don't exist (for example, if this
-      is post-commit and the proto-rev has been moved into
-      place). */
+  /* Delete protorev and its lock, which aren't in the txn directory.
+     It's OK if they don't exist (for example, if this is post-commit
+     and the proto-rev has been moved into place). */
   SVN_ERR(svn_io_remove_file2(
-                  svn_fs_x__path_txn_proto_rev(fs, txn_id, scratch_pool),
-                  TRUE, scratch_pool));
+                svn_fs_x__path_txn_proto_rev(fs, txn_id, subpool),
+                TRUE, subpool));
   SVN_ERR(svn_io_remove_file2(
-                  svn_fs_x__path_txn_proto_rev_lock(fs, txn_id, scratch_pool),
-                  TRUE, scratch_pool));
+                svn_fs_x__path_txn_proto_rev_lock(fs, txn_id, subpool),
+                TRUE, subpool));
 
+  svn_pool_destroy(subpool);
   return SVN_NO_ERROR;
 }