subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1366331 - /subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp
Date Fri, 27 Jul 2012 10:38:36 GMT
Author: rhuijben
Date: Fri Jul 27 10:38:36 2012
New Revision: 1366331

URL: http://svn.apache.org/viewvc?rev=1366331&view=rev
Log:
Call some library initialization functions from the JavaHL initialization.
While mostly optional this optimizes performance and memory usage.

* subversion/bindings/javahl/native/JNIUtil.cpp
  (JNIGlobalInit): Explicitly initialize the fs, utf and ra layers to avoid
    later threading issues. Disable the in-process caching.

Modified:
    subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp

Modified: subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp?rev=1366331&r1=1366330&r2=1366331&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp Fri Jul 27 10:38:36 2012
@@ -37,9 +37,13 @@
 #include <apr_lib.h>
 
 #include "svn_pools.h"
+#include "svn_fs.h"
+#include "svn_ra.h"
+#include "svn_utf.h"
 #include "svn_wc.h"
 #include "svn_dso.h"
 #include "svn_path.h"
+#include "svn_cache_config.h"
 #include <apr_file_info.h>
 #include "svn_private_config.h"
 #ifdef WIN32
@@ -175,6 +179,19 @@ bool JNIUtil::JNIGlobalInit(JNIEnv *env)
       apr_allocator_max_free_set(allocator, 1);
     }
 
+  svn_utf_initialize(pool); /* Optimize character conversions */
+  svn_fs_initialize(pool); /* Avoid some theoretical issues */
+  svn_ra_initialize(pool);
+
+  /* We shouldn't fill the JVMs memory with FS cache data unless explictly
+     requested. */
+  {
+    svn_cache_config_t settings = *svn_cache_config_get();
+    settings.cache_size = 0;
+    settings.file_handle_count = 0;
+    settings.single_threaded = FALSE;
+    svn_cache_config_set(&settings);
+  }
 
 #ifdef ENABLE_NLS
 #ifdef WIN32



Mime
View raw message