Author: stefan2
Date: Sat Apr 19 13:03:35 2014
New Revision: 1588653
URL: http://svn.apache.org/r1588653
Log:
Reduce the memory usage of any svn_fs_t instance by making
access to the vtable not allocate memory beyond the end of
vtable lookup function. As a side-effect, all functions
requiring temp. access to a repo benefit in the same way.
* subversion/libsvn_fs/fs-loader.c
(get_library_vtable): Document the parameter usage, POOL usage
in particular.
(fs_library_vtable): Use a subpool for all temporary allocations.
Modified:
subversion/trunk/subversion/libsvn_fs/fs-loader.c
Modified: subversion/trunk/subversion/libsvn_fs/fs-loader.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs/fs-loader.c?rev=1588653&r1=1588652&r2=1588653&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs/fs-loader.c (original)
+++ subversion/trunk/subversion/libsvn_fs/fs-loader.c Sat Apr 19 13:03:35 2014
@@ -246,7 +246,8 @@ get_or_allocate_third(struct fs_type_def
}
#endif
-/* Fetch a library vtable by FS type. */
+/* Fetch a library *VTABLE by FS_TYPE.
+ Use POOL for temporary allocations. */
static svn_error_t *
get_library_vtable(fs_library_vtable_t **vtable, const char *fs_type,
apr_pool_t *pool)
@@ -343,11 +344,15 @@ fs_library_vtable(fs_library_vtable_t **
apr_pool_t *pool)
{
const char *fs_type;
+ apr_pool_t *subpool = svn_pool_create(pool);
- SVN_ERR(svn_fs_type(&fs_type, path, pool));
+ SVN_ERR(svn_fs_type(&fs_type, path, subpool));
/* Fetch the library vtable by name, now that we've chosen one. */
- return svn_error_trace(get_library_vtable(vtable, fs_type, pool));
+ SVN_ERR(get_library_vtable(vtable, fs_type, subpool));
+ svn_pool_destroy(subpool);
+
+ return SVN_NO_ERROR;
}
static svn_error_t *