You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2010/04/09 14:07:36 UTC

svn commit: r932373 - /subversion/trunk/subversion/svnsync/main.c

Author: rhuijben
Date: Fri Apr  9 12:07:35 2010
New Revision: 932373

URL: http://svn.apache.org/viewvc?rev=932373&view=rev
Log:
Make svnsync initialize its memory management like our other applications.
(Mutex free and with a maximum amount of memory in the free list). This
should speed up memory allocation and also avoid fragmentation as apr's
memory manager doesn't handle defragmentation and the c (or os) allocator
does.

* subversion/svnsync/main.c
  (main): Initialize pool management with an explicit allocator.

Modified:
    subversion/trunk/subversion/svnsync/main.c

Modified: subversion/trunk/subversion/svnsync/main.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnsync/main.c?rev=932373&r1=932372&r2=932373&view=diff
==============================================================================
--- subversion/trunk/subversion/svnsync/main.c (original)
+++ subversion/trunk/subversion/svnsync/main.c Fri Apr  9 12:07:35 2010
@@ -1572,6 +1572,7 @@ main(int argc, const char *argv[])
   const char *username = NULL, *source_username = NULL, *sync_username = NULL;
   const char *password = NULL, *source_password = NULL, *sync_password = NULL;
   apr_array_header_t *config_options = NULL;
+  apr_allocator_t *allocator;
 
   if (svn_cmdline_init("svnsync", stderr) != EXIT_SUCCESS)
     {
@@ -1582,7 +1583,16 @@ main(int argc, const char *argv[])
   if (err)
     return svn_cmdline_handle_exit_error(err, NULL, "svnsync: ");
 
-  pool = svn_pool_create(NULL);
+  /* Create our top-level pool.  Use a separate mutexless allocator,
+   * given this application is single threaded.
+   */
+  if (apr_allocator_create(&allocator))
+    return EXIT_FAILURE;
+
+  apr_allocator_max_free_set(allocator, SVN_ALLOCATOR_RECOMMENDED_MAX_FREE);
+
+  pool = svn_pool_create_ex(NULL, allocator);
+  apr_allocator_owner_set(allocator, pool);
 
   err = svn_ra_initialize(pool);
   if (err)