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 2011/08/05 11:38:43 UTC

svn commit: r1154144 - /subversion/trunk/subversion/bindings/javahl/native/

Author: rhuijben
Date: Fri Aug  5 09:38:42 2011
New Revision: 1154144

URL: http://svn.apache.org/viewvc?rev=1154144&view=rev
Log:
In JavaHL: Get rid of the inheritly broken concept of per thread-request pools,
by adding the necessary arguments to handle proper subpools.
(Big bang commit... sorry. Partially moving between pools only creates new
 failuires)

This global 'request pool' concept breaks hard when mixing several clients
in a single thread (like from a callback) or when using the pool before before
and after the 'request'.
(In some cases this was handled as allocating in the global pool, which was
 never freed)

In this patch I tried to keep the original behavior. A few followups will
reduce memory usage a bit more by moving more data in the subpools.

* subversion/bindings/javahl/native/ClientContext.cpp
* subversion/bindings/javahl/native/ClientContext.h
* subversion/bindings/javahl/native/CopySources.h
* subversion/bindings/javahl/native/JNIThreadData.cpp
* subversion/bindings/javahl/native/JNIThreadData.h
* subversion/bindings/javahl/native/JNIUtil.cpp
* subversion/bindings/javahl/native/JNIUtil.h
* subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
* subversion/bindings/javahl/native/Path.cpp
* subversion/bindings/javahl/native/Path.h
* subversion/bindings/javahl/native/Pool.cpp
* subversion/bindings/javahl/native/Prompter.cpp
* subversion/bindings/javahl/native/Prompter.h
* subversion/bindings/javahl/native/SVNClient.cpp
* subversion/bindings/javahl/native/Targets.cpp
* subversion/bindings/javahl/native/Targets.h
  (*): Create subpools in the 'requests'. Pass the subpools down to where they
    are used.

Modified:
    subversion/trunk/subversion/bindings/javahl/native/ClientContext.cpp
    subversion/trunk/subversion/bindings/javahl/native/ClientContext.h
    subversion/trunk/subversion/bindings/javahl/native/CopySources.h
    subversion/trunk/subversion/bindings/javahl/native/JNIThreadData.cpp
    subversion/trunk/subversion/bindings/javahl/native/JNIThreadData.h
    subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp
    subversion/trunk/subversion/bindings/javahl/native/JNIUtil.h
    subversion/trunk/subversion/bindings/javahl/native/Path.cpp
    subversion/trunk/subversion/bindings/javahl/native/Path.h
    subversion/trunk/subversion/bindings/javahl/native/Pool.cpp
    subversion/trunk/subversion/bindings/javahl/native/Prompter.cpp
    subversion/trunk/subversion/bindings/javahl/native/Prompter.h
    subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp
    subversion/trunk/subversion/bindings/javahl/native/Targets.cpp
    subversion/trunk/subversion/bindings/javahl/native/Targets.h
    subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp

Modified: subversion/trunk/subversion/bindings/javahl/native/ClientContext.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/ClientContext.cpp?rev=1154144&r1=1154143&r2=1154144&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/ClientContext.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/ClientContext.cpp Fri Aug  5 09:38:42 2011
@@ -101,10 +101,9 @@ ClientContext::~ClientContext()
 }
 
 svn_client_ctx_t *
-ClientContext::getContext(CommitMessage *message)
+ClientContext::getContext(CommitMessage *message, SVN::Pool &in_pool)
 {
-    SVN::Pool *requestPool = JNIUtil::getRequestPool();
-    apr_pool_t *pool = requestPool->pool();
+    apr_pool_t *pool = in_pool.getPool();
     svn_auth_baton_t *ab;
     svn_client_ctx_t *ctx = persistentCtx;
     //SVN_JNI_ERR(svn_client_create_context(&ctx, pool), NULL);
@@ -174,22 +173,22 @@ ClientContext::getContext(CommitMessage 
     if (m_prompter != NULL)
     {
         /* Two basic prompt providers: username/password, and just username.*/
-        provider = m_prompter->getProviderSimple();
+        provider = m_prompter->getProviderSimple(in_pool);
 
         APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
 
-        provider = m_prompter->getProviderUsername();
+        provider = m_prompter->getProviderUsername(in_pool);
         APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
 
         /* Three ssl prompt providers, for server-certs, client-certs,
          * and client-cert-passphrases.  */
-        provider = m_prompter->getProviderServerSSLTrust();
+        provider = m_prompter->getProviderServerSSLTrust(in_pool);
         APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
 
-        provider = m_prompter->getProviderClientSSL();
+        provider = m_prompter->getProviderClientSSL(in_pool);
         APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
 
-        provider = m_prompter->getProviderClientSSLPassword();
+        provider = m_prompter->getProviderClientSSLPassword(in_pool);
         APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
     }
 
@@ -387,7 +386,8 @@ ClientContext::resolve(svn_wc_conflict_r
     {
       // If an exception is thrown by our conflict resolver, remove it
       // from the JNI env, and convert it into a Subversion error.
-      const char *msg = JNIUtil::thrownExceptionToCString();
+      SVN::Pool tmpPool(scratch_pool);
+      const char *msg = JNIUtil::thrownExceptionToCString(tmpPool);
       svn_error_t *err = svn_error_create(SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE,
                                           NULL, msg);
       env->PopLocalFrame(NULL);

Modified: subversion/trunk/subversion/bindings/javahl/native/ClientContext.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/ClientContext.h?rev=1154144&r1=1154143&r2=1154144&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/ClientContext.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/ClientContext.h Fri Aug  5 09:38:42 2011
@@ -75,7 +75,7 @@ class ClientContext
 
   static svn_error_t *checkCancel(void *cancelBaton);
 
-  svn_client_ctx_t *getContext(CommitMessage *message);
+  svn_client_ctx_t *getContext(CommitMessage *message, SVN::Pool &in_pool);
 
   void username(const char *pi_username);
   void password(const char *pi_password);

Modified: subversion/trunk/subversion/bindings/javahl/native/CopySources.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/CopySources.h?rev=1154144&r1=1154143&r2=1154144&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/CopySources.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/CopySources.h Fri Aug  5 09:38:42 2011
@@ -71,6 +71,9 @@ class CopySources
    * A local reference to the Java CopySources peer.
    */
   Array &m_copySources;
+
+  CopySources(const CopySources &from);
+  CopySources & operator=(const CopySources &);
 };
 
 #endif  /* COPY_SOURCES_H */

Modified: subversion/trunk/subversion/bindings/javahl/native/JNIThreadData.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/JNIThreadData.cpp?rev=1154144&r1=1154143&r2=1154144&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/JNIThreadData.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/JNIThreadData.cpp Fri Aug  5 09:38:42 2011
@@ -41,7 +41,6 @@ JNIThreadData::JNIThreadData()
 {
   m_env = NULL;
   m_exceptionThrown = false;
-  m_requestPool = NULL;
   m_previous = NULL;
 }
 

Modified: subversion/trunk/subversion/bindings/javahl/native/JNIThreadData.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/JNIThreadData.h?rev=1154144&r1=1154143&r2=1154144&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/JNIThreadData.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/JNIThreadData.h Fri Aug  5 09:38:42 2011
@@ -61,10 +61,6 @@ class JNIThreadData
    */
   char m_formatBuffer[JNIUtil::formatBufferSize];
 
-  /**
-   * The pool for the current request (call).
-   */
-  SVN::Pool *m_requestPool;
  private:
   /**
    * Pointer to previous thread information to enable reentrent

Modified: subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp?rev=1154144&r1=1154143&r2=1154144&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp Fri Aug  5 09:38:42 2011
@@ -619,7 +619,7 @@ bool JNIUtil::isJavaExceptionThrown()
 }
 
 const char *
-JNIUtil::thrownExceptionToCString()
+JNIUtil::thrownExceptionToCString(SVN::Pool &in_pool)
 {
   const char *msg;
   JNIEnv *env = getEnv();
@@ -636,7 +636,7 @@ JNIUtil::thrownExceptionToCString()
         }
       jstring jmsg = (jstring) env->CallObjectMethod(t, getMessage);
       JNIStringHolder tmp(jmsg);
-      msg = tmp.pstrdup(getRequestPool()->pool());
+      msg = tmp.pstrdup(in_pool.pool());
       // ### Conditionally add t.printStackTrace() to msg?
     }
   else
@@ -772,25 +772,6 @@ jobject JNIUtil::createDate(apr_time_t t
 }
 
 /**
- * Return the request pool. The request pool will be destroyed after each
- * request (call).
- * @return the pool to be used for this request
- */
-SVN::Pool *JNIUtil::getRequestPool()
-{
-  return JNIThreadData::getThreadData()->m_requestPool;
-}
-
-/**
- * Set the request pool in thread local storage.
- * @param pool  the request pool
- */
-void JNIUtil::setRequestPool(SVN::Pool *pool)
-{
-  JNIThreadData::getThreadData()->m_requestPool = pool;
-}
-
-/**
  * Create a Java byte array from an array of characters.
  * @param data      the character array
  * @param length    the number of characters in the array

Modified: subversion/trunk/subversion/bindings/javahl/native/JNIUtil.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/JNIUtil.h?rev=1154144&r1=1154143&r2=1154144&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/JNIUtil.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/JNIUtil.h Fri Aug  5 09:38:42 2011
@@ -63,8 +63,6 @@ class JNIUtil
 
   static void throwNullPointerException(const char *message);
   static jbyteArray makeJByteArray(const signed char *data, int length);
-  static void setRequestPool(SVN::Pool *pool);
-  static SVN::Pool *getRequestPool();
   static jobject createDate(apr_time_t time);
   static void logMessage(const char *message);
   static int getLogLevel();
@@ -103,7 +101,7 @@ class JNIUtil
    * occurred. Useful for converting Java @c Exceptions into @c
    * svn_error_t's.
    */
-  static const char *thrownExceptionToCString();
+  static const char *thrownExceptionToCString(SVN::Pool &in_pool);
 
   /**
    * Throw a Java exception corresponding to err, and run

Modified: subversion/trunk/subversion/bindings/javahl/native/Path.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/Path.cpp?rev=1154144&r1=1154143&r2=1154144&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/Path.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/Path.cpp Fri Aug  5 09:38:42 2011
@@ -36,9 +36,9 @@
  * @see Path::Path(const std::string &)
  * @param path Path string
  */
-Path::Path(const char *pi_path)
+Path::Path(const char *pi_path, SVN::Pool &in_pool)
 {
-  init(pi_path);
+  init(pi_path, in_pool);
 }
 
 /**
@@ -48,9 +48,9 @@ Path::Path(const char *pi_path)
  *
  * @param path Path string
  */
-Path::Path(const std::string &pi_path)
+Path::Path(const std::string &pi_path, SVN::Pool &in_pool)
 {
-  init(pi_path.c_str());
+  init(pi_path.c_str(), in_pool);
 }
 
 /**
@@ -58,9 +58,9 @@ Path::Path(const std::string &pi_path)
  *
  * @param path Path to be copied
  */
-Path::Path(const Path &pi_path)
+Path::Path(const Path &pi_path, SVN::Pool &in_pool)
 {
-  init(pi_path.c_str());
+  init(pi_path.c_str(), in_pool);
 }
 
 /**
@@ -69,7 +69,7 @@ Path::Path(const Path &pi_path)
  * @param path Path string
  */
 void
-Path::init(const char *pi_path)
+Path::init(const char *pi_path, SVN::Pool &in_pool)
 {
   if (*pi_path == 0)
     {
@@ -78,9 +78,7 @@ Path::init(const char *pi_path)
     }
   else
     {
-      m_error_occured =
-        JNIUtil::preprocessPath(pi_path,
-                                JNIUtil::getRequestPool()->pool() );
+      m_error_occured = JNIUtil::preprocessPath(pi_path, in_pool.pool());
 
       m_path = pi_path;
     }
@@ -110,7 +108,9 @@ Path::c_str() const
 Path&
 Path::operator=(const Path &pi_path)
 {
-  init(pi_path.c_str());
+  m_error_occured = NULL;
+  m_path = pi_path.m_path;
+
   return *this;
 }
 

Modified: subversion/trunk/subversion/bindings/javahl/native/Path.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/Path.h?rev=1154144&r1=1154143&r2=1154144&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/Path.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/Path.h Fri Aug  5 09:38:42 2011
@@ -29,6 +29,7 @@
 
 #include <string>
 #include <jni.h>
+#include "Pool.h"
 struct svn_error_t;
 
 /**
@@ -47,7 +48,7 @@ class Path
    *
    * @param pi_path Path string
    */
-  void init(const char *pi_path);
+  void init(const char *pi_path, SVN::Pool &in_pool);
 
  public:
   /**
@@ -57,7 +58,7 @@ class Path
    *
    * @param pi_path Path string
    */
-  Path(const std::string &pi_path = "");
+  Path(const std::string &pi_path, SVN::Pool &in_pool);
 
   /**
    * Constructor
@@ -65,14 +66,14 @@ class Path
    * @see Path::Path (const std::string &)
    * @param pi_path Path string
    */
-  Path(const char *pi_path);
+  Path(const char *pi_path, SVN::Pool &in_pool);
 
   /**
    * Copy constructor
    *
    * @param pi_path Path to be copied
    */
-  Path(const Path &pi_path);
+  Path(const Path &pi_path, SVN::Pool &in_pool);
 
   /**
    * Assignment operator

Modified: subversion/trunk/subversion/bindings/javahl/native/Pool.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/Pool.cpp?rev=1154144&r1=1154143&r2=1154144&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/Pool.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/Pool.cpp Fri Aug  5 09:38:42 2011
@@ -37,7 +37,6 @@
 SVN::Pool::Pool()
 {
   m_pool = svn_pool_create(JNIUtil::getPool());
-  JNIUtil::setRequestPool(this);
   m_request_pool = true;
 }
 
@@ -59,9 +58,6 @@ SVN::Pool::Pool(apr_pool_t *parent_pool)
  */
 SVN::Pool::~Pool()
 {
-  if (m_request_pool)
-    JNIUtil::setRequestPool(NULL);
-
   if (m_pool)
     {
       svn_pool_destroy(m_pool);

Modified: subversion/trunk/subversion/bindings/javahl/native/Prompter.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/Prompter.cpp?rev=1154144&r1=1154143&r2=1154144&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/Prompter.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/Prompter.cpp Fri Aug  5 09:38:42 2011
@@ -361,9 +361,9 @@ bool Prompter::prompt(const char *realm,
   return ret ? true:false;
 }
 
-svn_auth_provider_object_t *Prompter::getProviderSimple()
+svn_auth_provider_object_t *Prompter::getProviderSimple(SVN::Pool &in_pool)
 {
-  apr_pool_t *pool = JNIUtil::getRequestPool()->pool();
+  apr_pool_t *pool = in_pool.pool();
   svn_auth_provider_object_t *provider;
   svn_auth_get_simple_prompt_provider(&provider,
                                       simple_prompt,
@@ -374,9 +374,9 @@ svn_auth_provider_object_t *Prompter::ge
   return provider;
 }
 
-svn_auth_provider_object_t *Prompter::getProviderUsername()
+svn_auth_provider_object_t *Prompter::getProviderUsername(SVN::Pool &in_pool)
 {
-  apr_pool_t *pool = JNIUtil::getRequestPool()->pool();
+  apr_pool_t *pool = in_pool.pool();
   svn_auth_provider_object_t *provider;
   svn_auth_get_username_prompt_provider(&provider,
                                         username_prompt,
@@ -387,9 +387,9 @@ svn_auth_provider_object_t *Prompter::ge
   return provider;
 }
 
-svn_auth_provider_object_t *Prompter::getProviderServerSSLTrust()
+svn_auth_provider_object_t *Prompter::getProviderServerSSLTrust(SVN::Pool &in_pool)
 {
-  apr_pool_t *pool = JNIUtil::getRequestPool()->pool();
+  apr_pool_t *pool = in_pool.pool();
   svn_auth_provider_object_t *provider;
   svn_auth_get_ssl_server_trust_prompt_provider
     (&provider, ssl_server_trust_prompt, this, pool);
@@ -397,9 +397,9 @@ svn_auth_provider_object_t *Prompter::ge
   return provider;
 }
 
-svn_auth_provider_object_t *Prompter::getProviderClientSSL()
+svn_auth_provider_object_t *Prompter::getProviderClientSSL(SVN::Pool &in_pool)
 {
-  apr_pool_t *pool = JNIUtil::getRequestPool()->pool();
+  apr_pool_t *pool = in_pool.pool();
   svn_auth_provider_object_t *provider;
   svn_auth_get_ssl_client_cert_prompt_provider(&provider,
                                                ssl_client_cert_prompt,
@@ -410,9 +410,9 @@ svn_auth_provider_object_t *Prompter::ge
   return provider;
 }
 
-svn_auth_provider_object_t *Prompter::getProviderClientSSLPassword()
+svn_auth_provider_object_t *Prompter::getProviderClientSSLPassword(SVN::Pool &in_pool)
 {
-  apr_pool_t *pool = JNIUtil::getRequestPool()->pool();
+  apr_pool_t *pool = in_pool.pool();
   svn_auth_provider_object_t *provider;
   svn_auth_get_ssl_client_cert_pw_prompt_provider
     (&provider, ssl_client_cert_pw_prompt, this, 2 /* retry limit */,

Modified: subversion/trunk/subversion/bindings/javahl/native/Prompter.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/Prompter.h?rev=1154144&r1=1154143&r2=1154144&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/Prompter.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/Prompter.h Fri Aug  5 09:38:42 2011
@@ -30,7 +30,7 @@
 #include <jni.h>
 #include "svn_auth.h"
 #include <string>
-
+#include "Pool.h"
 /**
  * This class requests username/password and informations about
  * ssl-certificates from the user.
@@ -96,11 +96,11 @@ class Prompter
  public:
   static Prompter *makeCPrompter(jobject jprompter);
   ~Prompter();
-  svn_auth_provider_object_t *getProviderUsername();
-  svn_auth_provider_object_t *getProviderSimple();
-  svn_auth_provider_object_t *getProviderServerSSLTrust();
-  svn_auth_provider_object_t *getProviderClientSSL();
-  svn_auth_provider_object_t *getProviderClientSSLPassword();
+  svn_auth_provider_object_t *getProviderUsername(SVN::Pool &in_pool);
+  svn_auth_provider_object_t *getProviderSimple(SVN::Pool &in_pool);
+  svn_auth_provider_object_t *getProviderServerSSLTrust(SVN::Pool &in_pool);
+  svn_auth_provider_object_t *getProviderClientSSL(SVN::Pool &in_pool);
+  svn_auth_provider_object_t *getProviderClientSSLPassword(SVN::Pool &in_pool);
 
   static svn_error_t *plaintext_prompt(svn_boolean_t *may_save_plaintext,
                                        const char *realmstring,

Modified: subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp?rev=1154144&r1=1154143&r2=1154144&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp Fri Aug  5 09:38:42 2011
@@ -70,7 +70,7 @@
 
 
 SVNClient::SVNClient(jobject jthis_in)
-    : context(jthis_in, pool)
+    : context(jthis_in, pool), m_lastPath("", pool)
 {
 }
 
@@ -94,9 +94,9 @@ void SVNClient::dispose()
 
 jstring SVNClient::getAdminDirectoryName()
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
     jstring name =
-        JNIUtil::makeJString(svn_wc_get_adm_dir(requestPool.pool()));
+        JNIUtil::makeJString(svn_wc_get_adm_dir(subPool.pool()));
     if (JNIUtil::isJavaExceptionThrown())
         return NULL;
 
@@ -105,8 +105,8 @@ jstring SVNClient::getAdminDirectoryName
 
 jboolean SVNClient::isAdminDirectory(const char *name)
 {
-    SVN::Pool requestPool;
-    return svn_wc_is_adm_dir(name, requestPool.pool()) ? JNI_TRUE : JNI_FALSE;
+    SVN::Pool subPool(pool);
+    return svn_wc_is_adm_dir(name, subPool.pool()) ? JNI_TRUE : JNI_FALSE;
 }
 
 const char *SVNClient::getLastPath()
@@ -122,14 +122,14 @@ void SVNClient::list(const char *url, Re
                      int direntFields, bool fetchLocks,
                      ListCallback *callback)
 {
-    SVN::Pool requestPool;
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    SVN::Pool subPool(pool);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     if (ctx == NULL)
         return;
 
     SVN_JNI_NULL_PTR_EX(url, "path or url", );
 
-    Path urlPath(url);
+    Path urlPath(url, subPool);
     SVN_JNI_ERR(urlPath.error_occured(), );
 
     SVN_JNI_ERR(svn_client_list2(urlPath.c_str(),
@@ -140,7 +140,7 @@ void SVNClient::list(const char *url, Re
                                  fetchLocks,
                                  ListCallback::callback,
                                  callback,
-                                 ctx, requestPool.pool()), );
+                                 ctx, subPool.pool()), );
 }
 
 void
@@ -149,18 +149,18 @@ SVNClient::status(const char *path, svn_
                   bool ignoreExternals, StringArray &changelists,
                   StatusCallback *callback)
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
     svn_revnum_t youngest = SVN_INVALID_REVNUM;
     svn_opt_revision_t rev;
 
     SVN_JNI_NULL_PTR_EX(path, "path", );
 
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     if (ctx == NULL)
         return;
     callback->setWcCtx(ctx->wc_ctx);
 
-    Path checkedPath(path);
+    Path checkedPath(path, subPool);
     SVN_JNI_ERR(checkedPath.error_occured(), );
 
     rev.kind = svn_opt_revision_unspecified;
@@ -170,9 +170,9 @@ SVNClient::status(const char *path, svn_
                                    depth,
                                    getAll, onServer, noIgnore, FALSE,
                                    ignoreExternals,
-                                   changelists.array(requestPool),
+                                   changelists.array(subPool),
                                    StatusCallback::callback, callback,
-                                   requestPool.pool()), );
+                                   subPool.pool()), );
 }
 
 void SVNClient::logMessages(const char *path, Revision &pegRevision,
@@ -181,32 +181,32 @@ void SVNClient::logMessages(const char *
                             bool includeMergedRevisions, StringArray &revProps,
                             long limit, LogMessageCallback *callback)
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
 
     SVN_JNI_NULL_PTR_EX(path, "path", );
 
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     if (ctx == NULL)
         return;
 
-    Targets target(path);
-    const apr_array_header_t *targets = target.array(requestPool);
+    Targets target(path, subPool);
+    const apr_array_header_t *targets = target.array(subPool);
     SVN_JNI_ERR(target.error_occured(), );
 
     apr_array_header_t *ranges =
-        apr_array_make(requestPool.pool(), logRanges.size(),
+        apr_array_make(subPool.pool(), logRanges.size(),
                        sizeof(svn_opt_revision_range_t *));
 
     std::vector<RevisionRange>::const_iterator it;
     for (it = logRanges.begin(); it != logRanges.end(); ++it)
     {
-        if (it->toRange(requestPool)->start.kind
+        if (it->toRange(subPool)->start.kind
             == svn_opt_revision_unspecified
-            && it->toRange(requestPool)->end.kind
+            && it->toRange(subPool)->end.kind
             == svn_opt_revision_unspecified)
         {
             svn_opt_revision_range_t *range =
-                (svn_opt_revision_range_t *)apr_pcalloc(requestPool.pool(),
+                (svn_opt_revision_range_t *)apr_pcalloc(subPool.pool(),
                                                         sizeof(*range));
             range->start.kind = svn_opt_revision_number;
             range->start.value.number = 1;
@@ -216,7 +216,7 @@ void SVNClient::logMessages(const char *
         else
         {
             APR_ARRAY_PUSH(ranges, const svn_opt_revision_range_t *) =
-                it->toRange(requestPool);
+                it->toRange(subPool);
         }
         if (JNIUtil::isExceptionThrown())
             return;
@@ -225,9 +225,9 @@ void SVNClient::logMessages(const char *
     SVN_JNI_ERR(svn_client_log5(targets, pegRevision.revision(), ranges,
                                 limit, discoverPaths, stopOnCopy,
                                 includeMergedRevisions,
-                                revProps.array(requestPool),
+                                revProps.array(subPool),
                                 LogMessageCallback::callback, callback, ctx,
-                                requestPool.pool()), );
+                                subPool.pool()), );
 }
 
 jlong SVNClient::checkout(const char *moduleName, const char *destPath,
@@ -235,18 +235,18 @@ jlong SVNClient::checkout(const char *mo
                           svn_depth_t depth, bool ignoreExternals,
                           bool allowUnverObstructions)
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool;
 
     SVN_JNI_NULL_PTR_EX(moduleName, "moduleName", -1);
     SVN_JNI_NULL_PTR_EX(destPath, "destPath", -1);
 
-    Path url(moduleName);
-    Path path(destPath);
+    Path url(moduleName, subPool);
+    Path path(destPath, subPool);
     SVN_JNI_ERR(url.error_occured(), -1);
     SVN_JNI_ERR(path.error_occured(), -1);
     svn_revnum_t rev;
 
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     if (ctx == NULL)
         return -1;
 
@@ -258,7 +258,7 @@ jlong SVNClient::checkout(const char *mo
                                      ignoreExternals,
                                      allowUnverObstructions,
                                      ctx,
-                                     requestPool.pool()),
+                                     subPool.pool()),
                 -1);
 
     return rev;
@@ -268,56 +268,56 @@ void SVNClient::remove(Targets &targets,
                        bool keep_local, RevpropTable &revprops,
                        CommitCallback *callback)
 {
-    SVN::Pool requestPool;
-    svn_client_ctx_t *ctx = context.getContext(message);
+    SVN::Pool subPool(pool);
+    svn_client_ctx_t *ctx = context.getContext(message, subPool);
     if (ctx == NULL)
         return;
 
-    const apr_array_header_t *targets2 = targets.array(requestPool);
+    const apr_array_header_t *targets2 = targets.array(subPool);
     SVN_JNI_ERR(targets.error_occured(), );
 
     SVN_JNI_ERR(svn_client_delete4(targets2, force, keep_local,
-                                   revprops.hash(requestPool),
+                                   revprops.hash(subPool),
                                    CommitCallback::callback, callback,
-                                   ctx, requestPool.pool()), );
+                                   ctx, subPool.pool()), );
 }
 
 void SVNClient::revert(const char *path, svn_depth_t depth,
                        StringArray &changelists)
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
 
     SVN_JNI_NULL_PTR_EX(path, "path", );
 
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     if (ctx == NULL)
         return;
 
-    Targets target(path);
-    const apr_array_header_t *targets = target.array(requestPool);
+    Targets target(path, subPool);
+    const apr_array_header_t *targets = target.array(subPool);
     SVN_JNI_ERR(target.error_occured(), );
     SVN_JNI_ERR(svn_client_revert2(targets, depth,
-                                   changelists.array(requestPool), ctx,
-                                   requestPool.pool()), );
+                                   changelists.array(subPool), ctx,
+                                   subPool.pool()), );
 }
 
 void SVNClient::add(const char *path,
                     svn_depth_t depth, bool force, bool no_ignore,
                     bool add_parents)
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
 
     SVN_JNI_NULL_PTR_EX(path, "path", );
 
-    Path intPath(path);
+    Path intPath(path, subPool);
     SVN_JNI_ERR(intPath.error_occured(), );
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     if (ctx == NULL)
         return;
 
     SVN_JNI_ERR(svn_client_add4(intPath.c_str(), depth, force,
                                 no_ignore, add_parents, ctx,
-                                requestPool.pool()), );
+                                subPool.pool()), );
 }
 
 jlongArray SVNClient::update(Targets &targets, Revision &revision,
@@ -325,14 +325,14 @@ jlongArray SVNClient::update(Targets &ta
                              bool makeParents, bool ignoreExternals,
                              bool allowUnverObstructions)
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
 
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     apr_array_header_t *revs;
     if (ctx == NULL)
         return NULL;
 
-    const apr_array_header_t *array = targets.array(requestPool);
+    const apr_array_header_t *array = targets.array(subPool);
     SVN_JNI_ERR(targets.error_occured(), NULL);
     SVN_JNI_ERR(svn_client_update4(&revs, array,
                                    revision.revision(),
@@ -342,7 +342,7 @@ jlongArray SVNClient::update(Targets &ta
                                    allowUnverObstructions,
                                    TRUE /* adds_as_modification */,
                                    makeParents,
-                                   ctx, requestPool.pool()),
+                                   ctx, subPool.pool()),
                 NULL);
 
     JNIEnv *env = JNIUtil::getEnv();
@@ -367,19 +367,19 @@ void SVNClient::commit(Targets &targets,
                        StringArray &changelists, RevpropTable &revprops,
                        CommitCallback *callback)
 {
-    SVN::Pool requestPool;
-    const apr_array_header_t *targets2 = targets.array(requestPool);
+    SVN::Pool subPool(pool);
+    const apr_array_header_t *targets2 = targets.array(subPool);
     SVN_JNI_ERR(targets.error_occured(), );
-    svn_client_ctx_t *ctx = context.getContext(message);
+    svn_client_ctx_t *ctx = context.getContext(message, subPool);
     if (ctx == NULL)
         return;
 
     SVN_JNI_ERR(svn_client_commit5(targets2, depth,
                                    noUnlock, keepChangelist, TRUE,
-                                   changelists.array(requestPool),
-                                   revprops.hash(requestPool),
+                                   changelists.array(subPool),
+                                   revprops.hash(subPool),
                                    CommitCallback::callback, callback,
-                                   ctx, requestPool.pool()),
+                                   ctx, subPool.pool()),
                 );
 }
 
@@ -388,9 +388,9 @@ void SVNClient::copy(CopySources &copySo
                      bool makeParents, bool ignoreExternals,
                      RevpropTable &revprops, CommitCallback *callback)
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
 
-    apr_array_header_t *srcs = copySources.array(requestPool);
+    apr_array_header_t *srcs = copySources.array(subPool);
     if (srcs == NULL)
     {
         JNIUtil::throwNativeException(JAVA_PACKAGE "/ClientException",
@@ -398,18 +398,18 @@ void SVNClient::copy(CopySources &copySo
         return;
     }
     SVN_JNI_NULL_PTR_EX(destPath, "destPath", );
-    Path destinationPath(destPath);
+    Path destinationPath(destPath, subPool);
     SVN_JNI_ERR(destinationPath.error_occured(), );
 
-    svn_client_ctx_t *ctx = context.getContext(message);
+    svn_client_ctx_t *ctx = context.getContext(message, subPool);
     if (ctx == NULL)
         return;
 
     SVN_JNI_ERR(svn_client_copy6(srcs, destinationPath.c_str(),
                                  copyAsChild, makeParents, ignoreExternals,
-                                 revprops.hash(requestPool),
+                                 revprops.hash(subPool),
                                  CommitCallback::callback, callback,
-                                 ctx, requestPool.pool()), );
+                                 ctx, subPool.pool()), );
 }
 
 void SVNClient::move(Targets &srcPaths, const char *destPath,
@@ -417,70 +417,70 @@ void SVNClient::move(Targets &srcPaths, 
                      bool makeParents, RevpropTable &revprops,
                      CommitCallback *callback)
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
 
-    const apr_array_header_t *srcs = srcPaths.array(requestPool);
+    const apr_array_header_t *srcs = srcPaths.array(subPool);
     SVN_JNI_ERR(srcPaths.error_occured(), );
     SVN_JNI_NULL_PTR_EX(destPath, "destPath", );
-    Path destinationPath(destPath);
+    Path destinationPath(destPath, subPool);
     SVN_JNI_ERR(destinationPath.error_occured(), );
 
-    svn_client_ctx_t *ctx = context.getContext(message);
+    svn_client_ctx_t *ctx = context.getContext(message, subPool);
     if (ctx == NULL)
         return;
 
     SVN_JNI_ERR(svn_client_move6((apr_array_header_t *) srcs,
                                  destinationPath.c_str(), moveAsChild,
-                                 makeParents, revprops.hash(requestPool),
+                                 makeParents, revprops.hash(subPool),
                                  CommitCallback::callback, callback, ctx,
-                                 requestPool.pool()), );
+                                 subPool.pool()), );
 }
 
 void SVNClient::mkdir(Targets &targets, CommitMessage *message,
                       bool makeParents, RevpropTable &revprops,
                       CommitCallback *callback)
 {
-    SVN::Pool requestPool;
-    svn_client_ctx_t *ctx = context.getContext(message);
+    SVN::Pool subPool(pool);
+    svn_client_ctx_t *ctx = context.getContext(message, subPool);
     if (ctx == NULL)
         return;
 
-    const apr_array_header_t *targets2 = targets.array(requestPool);
+    const apr_array_header_t *targets2 = targets.array(subPool);
     SVN_JNI_ERR(targets.error_occured(), );
 
     SVN_JNI_ERR(svn_client_mkdir4(targets2, makeParents,
-                                  revprops.hash(requestPool),
+                                  revprops.hash(subPool),
                                   CommitCallback::callback, callback,
-                                  ctx, requestPool.pool()), );
+                                  ctx, subPool.pool()), );
 }
 
 void SVNClient::cleanup(const char *path)
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
     SVN_JNI_NULL_PTR_EX(path, "path", );
-    Path intPath(path);
+    Path intPath(path, subPool);
     SVN_JNI_ERR(intPath.error_occured(), );
 
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     if (ctx == NULL)
         return;
 
-    SVN_JNI_ERR(svn_client_cleanup(intPath.c_str(), ctx, requestPool.pool()),);
+    SVN_JNI_ERR(svn_client_cleanup(intPath.c_str(), ctx, subPool.pool()),);
 }
 
 void SVNClient::resolve(const char *path, svn_depth_t depth,
                         svn_wc_conflict_choice_t choice)
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
     SVN_JNI_NULL_PTR_EX(path, "path", );
-    Path intPath(path);
+    Path intPath(path, subPool);
     SVN_JNI_ERR(intPath.error_occured(), );
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     if (ctx == NULL)
         return;
 
     SVN_JNI_ERR(svn_client_resolve(intPath.c_str(), depth, choice,
-                                   ctx, requestPool.pool()), );
+                                   ctx, subPool.pool()), );
 }
 
 jlong SVNClient::doExport(const char *srcPath, const char *destPath,
@@ -488,15 +488,15 @@ jlong SVNClient::doExport(const char *sr
                           bool force, bool ignoreExternals,
                           svn_depth_t depth, const char *nativeEOL)
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
     SVN_JNI_NULL_PTR_EX(srcPath, "srcPath", -1);
     SVN_JNI_NULL_PTR_EX(destPath, "destPath", -1);
-    Path sourcePath(srcPath);
+    Path sourcePath(srcPath, subPool);
     SVN_JNI_ERR(sourcePath.error_occured(), -1);
-    Path destinationPath(destPath);
+    Path destinationPath(destPath, subPool);
     SVN_JNI_ERR(destinationPath.error_occured(), -1);
     svn_revnum_t rev;
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     if (ctx == NULL)
         return -1;
 
@@ -507,7 +507,7 @@ jlong SVNClient::doExport(const char *sr
                                    ignoreExternals, FALSE,
                                    depth,
                                    nativeEOL, ctx,
-                                   requestPool.pool()),
+                                   subPool.pool()),
                 -1);
 
     return rev;
@@ -521,16 +521,16 @@ jlong SVNClient::doSwitch(const char *pa
                           bool allowUnverObstructions,
                           bool ignoreAncestry)
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
     SVN_JNI_NULL_PTR_EX(path, "path", -1);
     SVN_JNI_NULL_PTR_EX(url, "url", -1);
-    Path intUrl(url);
+    Path intUrl(url, subPool);
     SVN_JNI_ERR(intUrl.error_occured(), -1);
-    Path intPath(path);
+    Path intPath(path, subPool);
     SVN_JNI_ERR(intPath.error_occured(), -1);
 
     svn_revnum_t rev;
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     if (ctx == NULL)
         return -1;
 
@@ -544,7 +544,7 @@ jlong SVNClient::doSwitch(const char *pa
                                    allowUnverObstructions,
                                    ignoreAncestry,
                                    ctx,
-                                   requestPool.pool()),
+                                   subPool.pool()),
                 -1);
 
     return rev;
@@ -555,37 +555,37 @@ void SVNClient::doImport(const char *pat
                          bool noIgnore, bool ignoreUnknownNodeTypes,
                          RevpropTable &revprops, CommitCallback *callback)
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
     SVN_JNI_NULL_PTR_EX(path, "path", );
     SVN_JNI_NULL_PTR_EX(url, "url", );
-    Path intPath(path);
+    Path intPath(path, subPool);
     SVN_JNI_ERR(intPath.error_occured(), );
-    Path intUrl(url);
+    Path intUrl(url, subPool);
     SVN_JNI_ERR(intUrl.error_occured(), );
 
-    svn_client_ctx_t *ctx = context.getContext(message);
+    svn_client_ctx_t *ctx = context.getContext(message, subPool);
     if (ctx == NULL)
         return;
 
     SVN_JNI_ERR(svn_client_import4(intPath.c_str(), intUrl.c_str(), depth,
                                    noIgnore, ignoreUnknownNodeTypes,
-                                   revprops.hash(requestPool),
+                                   revprops.hash(subPool),
                                    CommitCallback::callback, callback,
-                                   ctx, requestPool.pool()), );
+                                   ctx, subPool.pool()), );
 }
 
 jobject
 SVNClient::suggestMergeSources(const char *path, Revision &pegRevision)
 {
-    SVN::Pool requestPool;
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    SVN::Pool subPool(pool);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     if (ctx == NULL)
         return NULL;
 
     apr_array_header_t *sources;
     SVN_JNI_ERR(svn_client_suggest_merge_sources(&sources, path,
                                                  pegRevision.revision(),
-                                                 ctx, requestPool.pool()),
+                                                 ctx, subPool.pool()),
                 NULL);
 
     return CreateJ::StringSet(sources);
@@ -596,20 +596,20 @@ void SVNClient::merge(const char *path1,
                       const char *localPath, bool force, svn_depth_t depth,
                       bool ignoreAncestry, bool dryRun, bool recordOnly)
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
     SVN_JNI_NULL_PTR_EX(path1, "path1", );
     SVN_JNI_NULL_PTR_EX(path2, "path2", );
     SVN_JNI_NULL_PTR_EX(localPath, "localPath", );
-    Path intLocalPath(localPath);
+    Path intLocalPath(localPath, subPool);
     SVN_JNI_ERR(intLocalPath.error_occured(), );
 
-    Path srcPath1(path1);
+    Path srcPath1(path1, subPool);
     SVN_JNI_ERR(srcPath1.error_occured(), );
 
-    Path srcPath2 = path2;
+    Path srcPath2(path2, subPool);
     SVN_JNI_ERR(srcPath2.error_occured(), );
 
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     if (ctx == NULL)
         return;
 
@@ -618,7 +618,7 @@ void SVNClient::merge(const char *path1,
                                   intLocalPath.c_str(),
                                   depth,
                                   ignoreAncestry, force, recordOnly, dryRun,
-                                  TRUE, NULL, ctx, requestPool.pool()), );
+                                  TRUE, NULL, ctx, subPool.pool()), );
 }
 
 void SVNClient::merge(const char *path, Revision &pegRevision,
@@ -626,33 +626,33 @@ void SVNClient::merge(const char *path, 
                       const char *localPath, bool force, svn_depth_t depth,
                       bool ignoreAncestry, bool dryRun, bool recordOnly)
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
     SVN_JNI_NULL_PTR_EX(path, "path", );
     SVN_JNI_NULL_PTR_EX(localPath, "localPath", );
-    Path intLocalPath(localPath);
+    Path intLocalPath(localPath, subPool);
     SVN_JNI_ERR(intLocalPath.error_occured(), );
 
-    Path srcPath(path);
+    Path srcPath(path, subPool);
     SVN_JNI_ERR(srcPath.error_occured(), );
 
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     if (ctx == NULL)
         return;
 
     apr_array_header_t *ranges =
-      apr_array_make(requestPool.pool(), rangesToMerge.size(),
+      apr_array_make(subPool.pool(), rangesToMerge.size(),
                      sizeof(const svn_opt_revision_range_t *));
 
     std::vector<RevisionRange>::const_iterator it;
     for (it = rangesToMerge.begin(); it != rangesToMerge.end(); ++it)
     {
-        if (it->toRange(requestPool)->start.kind
+        if (it->toRange(subPool)->start.kind
             == svn_opt_revision_unspecified
-            && it->toRange(requestPool)->end.kind
+            && it->toRange(subPool)->end.kind
             == svn_opt_revision_unspecified)
         {
             svn_opt_revision_range_t *range =
-                (svn_opt_revision_range_t *)apr_pcalloc(requestPool.pool(),
+                (svn_opt_revision_range_t *)apr_pcalloc(subPool.pool(),
                                                         sizeof(*range));
             range->start.kind = svn_opt_revision_number;
             range->start.value.number = 1;
@@ -662,7 +662,7 @@ void SVNClient::merge(const char *path, 
         else
         {
             APR_ARRAY_PUSH(ranges, const svn_opt_revision_range_t *) =
-                it->toRange(requestPool);
+                it->toRange(subPool);
         }
         if (JNIUtil::isExceptionThrown())
             return;
@@ -675,22 +675,22 @@ void SVNClient::merge(const char *path, 
                                       depth,
                                       ignoreAncestry, force, recordOnly,
                                       dryRun, TRUE, NULL, ctx,
-                                      requestPool.pool()), );
+                                      subPool.pool()), );
 }
 
 void SVNClient::mergeReintegrate(const char *path, Revision &pegRevision,
                                  const char *localPath, bool dryRun)
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
     SVN_JNI_NULL_PTR_EX(path, "path", );
     SVN_JNI_NULL_PTR_EX(localPath, "localPath", );
-    Path intLocalPath(localPath);
+    Path intLocalPath(localPath, subPool);
     SVN_JNI_ERR(intLocalPath.error_occured(), );
 
-    Path srcPath(path);
+    Path srcPath(path, subPool);
     SVN_JNI_ERR(srcPath.error_occured(), );
 
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     if (ctx == NULL)
         return;
 
@@ -698,26 +698,26 @@ void SVNClient::mergeReintegrate(const c
                                              pegRevision.revision(),
                                              intLocalPath.c_str(),
                                              dryRun, NULL, ctx,
-                                             requestPool.pool()), );
+                                             subPool.pool()), );
 }
 
 jobject
 SVNClient::getMergeinfo(const char *target, Revision &pegRevision)
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
     JNIEnv *env = JNIUtil::getEnv();
 
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     if (ctx == NULL)
         return NULL;
 
     svn_mergeinfo_t mergeinfo;
-    Path intLocalTarget(target);
+    Path intLocalTarget(target, subPool);
     SVN_JNI_ERR(intLocalTarget.error_occured(), NULL);
     SVN_JNI_ERR(svn_client_mergeinfo_get_merged(&mergeinfo,
                                                 intLocalTarget.c_str(),
                                                 pegRevision.revision(), ctx,
-                                                requestPool.pool()),
+                                                subPool.pool()),
                 NULL);
     if (mergeinfo == NULL)
         return NULL;
@@ -750,7 +750,7 @@ SVNClient::getMergeinfo(const char *targ
         return NULL;
 
     apr_hash_index_t *hi;
-    for (hi = apr_hash_first(requestPool.pool(), mergeinfo);
+    for (hi = apr_hash_first(subPool.pool(), mergeinfo);
          hi;
          hi = apr_hash_next(hi))
     {
@@ -782,18 +782,18 @@ void SVNClient::getMergeinfoLog(int type
                                 StringArray &revProps,
                                 LogMessageCallback *callback)
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
 
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     if (ctx == NULL)
         return;
 
     SVN_JNI_NULL_PTR_EX(pathOrURL, "path or url", );
-    Path urlPath(pathOrURL);
+    Path urlPath(pathOrURL, subPool);
     SVN_JNI_ERR(urlPath.error_occured(), );
 
     SVN_JNI_NULL_PTR_EX(mergeSourceURL, "merge source url", );
-    Path srcURL(mergeSourceURL);
+    Path srcURL(mergeSourceURL, subPool);
     SVN_JNI_ERR(srcURL.error_occured(), );
 
     SVN_JNI_ERR(svn_client_mergeinfo_log((type == 1),
@@ -805,9 +805,9 @@ void SVNClient::getMergeinfoLog(int type
                                          callback,
                                          discoverChangedPaths,
                                          depth,
-                                         revProps.array(requestPool),
+                                         revProps.array(subPool),
                                          ctx,
-                                         requestPool.pool()), );
+                                         subPool.pool()), );
 
     return;
 }
@@ -818,13 +818,13 @@ void SVNClient::getMergeinfoLog(int type
 jbyteArray SVNClient::propertyGet(const char *path, const char *name,
                                   Revision &revision, Revision &pegRevision)
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
     SVN_JNI_NULL_PTR_EX(path, "path", NULL);
     SVN_JNI_NULL_PTR_EX(name, "name", NULL);
-    Path intPath(path);
+    Path intPath(path, subPool);
     SVN_JNI_ERR(intPath.error_occured(), NULL);
 
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     if (ctx == NULL)
         return NULL;
 
@@ -832,12 +832,12 @@ jbyteArray SVNClient::propertyGet(const 
     SVN_JNI_ERR(svn_client_propget3(&props, name,
                                     intPath.c_str(), pegRevision.revision(),
                                     revision.revision(), NULL, svn_depth_empty,
-                                    NULL, ctx, requestPool.pool()),
+                                    NULL, ctx, subPool.pool()),
                 NULL);
 
     apr_hash_index_t *hi;
     // only one element since we disabled recurse
-    hi = apr_hash_first(requestPool.pool(), props);
+    hi = apr_hash_first(subPool.pool(), props);
     if (hi == NULL)
         return NULL; // no property with this name
 
@@ -855,20 +855,20 @@ void SVNClient::properties(const char *p
                            Revision &pegRevision, svn_depth_t depth,
                            StringArray &changelists, ProplistCallback *callback)
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
     SVN_JNI_NULL_PTR_EX(path, "path", );
-    Path intPath(path);
+    Path intPath(path, subPool);
     SVN_JNI_ERR(intPath.error_occured(), );
 
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     if (ctx == NULL)
         return;
 
     SVN_JNI_ERR(svn_client_proplist3(intPath.c_str(), pegRevision.revision(),
                                      revision.revision(), depth,
-                                     changelists.array(requestPool),
+                                     changelists.array(subPool),
                                      ProplistCallback::callback, callback,
-                                     ctx, requestPool.pool()), );
+                                     ctx, subPool.pool()), );
 
     return;
 }
@@ -877,7 +877,7 @@ void SVNClient::propertySetLocal(Targets
                                  JNIByteArray &value, svn_depth_t depth,
                                  StringArray &changelists, bool force)
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
     SVN_JNI_NULL_PTR_EX(name, "name", );
 
     svn_string_t *val;
@@ -885,17 +885,17 @@ void SVNClient::propertySetLocal(Targets
       val = NULL;
     else
       val = svn_string_ncreate((const char *)value.getBytes(), value.getLength(),
-                               requestPool.pool());
+                               subPool.pool());
 
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     if (ctx == NULL)
         return;
 
-    const apr_array_header_t *targetsApr = targets.array(requestPool);
+    const apr_array_header_t *targetsApr = targets.array(subPool);
     SVN_JNI_ERR(svn_client_propset_local(name, val, targetsApr,
                                          depth, force,
-                                         changelists.array(requestPool),
-                                         ctx, requestPool.pool()), );
+                                         changelists.array(subPool),
+                                         ctx, subPool.pool()), );
 }
 
 void SVNClient::propertySetRemote(const char *path, const char *name,
@@ -903,7 +903,7 @@ void SVNClient::propertySetRemote(const 
                                   RevpropTable &revprops,
                                   CommitCallback *callback)
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
     SVN_JNI_NULL_PTR_EX(name, "name", );
 
     svn_string_t *val;
@@ -911,20 +911,20 @@ void SVNClient::propertySetRemote(const 
       val = NULL;
     else
       val = svn_string_ncreate((const char *)value.getBytes(), value.getLength(),
-                               requestPool.pool());
+                               subPool.pool());
 
-    Path intPath(path);
+    Path intPath(path, subPool);
     SVN_JNI_ERR(intPath.error_occured(), );
 
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     if (ctx == NULL)
         return;
 
     SVN_JNI_ERR(svn_client_propset_remote(name, val, intPath.c_str(),
                                           force, SVN_INVALID_REVNUM,
-                                          revprops.hash(requestPool),
+                                          revprops.hash(subPool),
                                           CommitCallback::callback, callback,
-                                          ctx, requestPool.pool()), );
+                                          ctx, subPool.pool()), );
 }
 
 void SVNClient::diff(const char *target1, Revision &revision1,
@@ -936,9 +936,9 @@ void SVNClient::diff(const char *target1
                      bool showCopiesAsAdds)
 {
     svn_error_t *err;
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
     const char *c_relToDir = relativeToDir ?
-      svn_dirent_canonicalize(relativeToDir, requestPool.pool()) :
+      svn_dirent_canonicalize(relativeToDir, subPool.pool()) :
       relativeToDir;
 
     SVN_JNI_NULL_PTR_EX(target1, "target", );
@@ -947,20 +947,20 @@ void SVNClient::diff(const char *target1
         SVN_JNI_NULL_PTR_EX(target2, "target2", );
 
     SVN_JNI_NULL_PTR_EX(outfileName, "outfileName", );
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     if (ctx == NULL)
         return;
 
-    Path path1(target1);
+    Path path1(target1, subPool);
     SVN_JNI_ERR(path1.error_occured(), );
 
     apr_file_t *outfile = NULL;
     apr_status_t rv =
         apr_file_open(&outfile,
                       svn_dirent_internal_style(outfileName,
-                                                requestPool.pool()),
+                                                subPool.pool()),
                       APR_CREATE|APR_WRITE|APR_TRUNCATE , APR_OS_DEFAULT,
-                      requestPool.pool());
+                      subPool.pool());
     if (rv != APR_SUCCESS)
     {
         SVN_JNI_ERR(svn_error_createf(rv, NULL, _("Cannot open file '%s'"),
@@ -968,7 +968,7 @@ void SVNClient::diff(const char *target1
     }
 
     // We don't use any options to diff.
-    apr_array_header_t *diffOptions = apr_array_make(requestPool.pool(),
+    apr_array_header_t *diffOptions = apr_array_make(subPool.pool(),
                                                      0, sizeof(char *));
 
     if (pegRevision)
@@ -988,14 +988,14 @@ void SVNClient::diff(const char *target1
                                    SVN_APR_LOCALE_CHARSET,
                                    outfile,
                                    NULL /* error file */,
-                                   changelists.array(requestPool),
+                                   changelists.array(subPool),
                                    ctx,
-                                   requestPool.pool());
+                                   subPool.pool());
     }
     else
     {
         // "Regular" diff (without a peg revision).
-        Path path2(target2);
+        Path path2(target2, subPool);
         err = path2.error_occured();
         if (err)
         {
@@ -1020,9 +1020,9 @@ void SVNClient::diff(const char *target1
                                SVN_APR_LOCALE_CHARSET,
                                outfile,
                                NULL /* error file */,
-                               changelists.array(requestPool),
+                               changelists.array(subPool),
                                ctx,
-                               requestPool.pool());
+                               subPool.pool());
     }
 
 cleanup:
@@ -1069,28 +1069,28 @@ SVNClient::diffSummarize(const char *tar
                          bool ignoreAncestry,
                          DiffSummaryReceiver &receiver)
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
 
     SVN_JNI_NULL_PTR_EX(target1, "target1", );
     SVN_JNI_NULL_PTR_EX(target2, "target2", );
 
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     if (ctx == NULL)
         return;
 
-    Path path1(target1);
+    Path path1(target1, subPool);
     SVN_JNI_ERR(path1.error_occured(), );
-    Path path2(target2);
+    Path path2(target2, subPool);
     SVN_JNI_ERR(path2.error_occured(), );
 
     SVN_JNI_ERR(svn_client_diff_summarize2(path1.c_str(), revision1.revision(),
                                            path2.c_str(), revision2.revision(),
                                            depth,
                                            ignoreAncestry,
-                                           changelists.array(requestPool),
+                                           changelists.array(subPool),
                                            DiffSummaryReceiver::summarize,
                                            &receiver,
-                                           ctx, requestPool.pool()), );
+                                           ctx, subPool.pool()), );
 }
 
 void
@@ -1099,15 +1099,15 @@ SVNClient::diffSummarize(const char *tar
                          svn_depth_t depth, StringArray &changelists,
                          bool ignoreAncestry, DiffSummaryReceiver &receiver)
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
 
     SVN_JNI_NULL_PTR_EX(target, "target", );
 
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     if (ctx == NULL)
         return;
 
-    Path path(target);
+    Path path(target, subPool);
     SVN_JNI_ERR(path.error_occured(), );
 
     SVN_JNI_ERR(svn_client_diff_summarize_peg2(path.c_str(),
@@ -1116,41 +1116,41 @@ SVNClient::diffSummarize(const char *tar
                                                endRevision.revision(),
                                                depth,
                                                ignoreAncestry,
-                                               changelists.array(requestPool),
+                                               changelists.array(subPool),
                                                DiffSummaryReceiver::summarize,
                                                &receiver, ctx,
-                                               requestPool.pool()), );
+                                               subPool.pool()), );
 }
 
 void SVNClient::streamFileContent(const char *path, Revision &revision,
                                   Revision &pegRevision,
                                   OutputStream &outputStream)
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
     SVN_JNI_NULL_PTR_EX(path, "path", );
-    Path intPath(path);
+    Path intPath(path, subPool);
     SVN_JNI_ERR(intPath.error_occured(), );
 
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     if (ctx == NULL)
         return;
 
-    SVN_JNI_ERR(svn_client_cat2(outputStream.getStream(requestPool),
+    SVN_JNI_ERR(svn_client_cat2(outputStream.getStream(subPool),
                                 path, pegRevision.revision(),
-                                revision.revision(), ctx, requestPool.pool()),
+                                revision.revision(), ctx, subPool.pool()),
                 );
 }
 
 jbyteArray SVNClient::revProperty(const char *path,
                                   const char *name, Revision &rev)
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
     SVN_JNI_NULL_PTR_EX(path, "path", NULL);
     SVN_JNI_NULL_PTR_EX(name, "name", NULL);
-    Path intPath(path);
+    Path intPath(path, subPool);
     SVN_JNI_ERR(intPath.error_occured(), NULL);
 
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     if (ctx == NULL)
         return NULL;
 
@@ -1158,8 +1158,8 @@ jbyteArray SVNClient::revProperty(const 
     svn_string_t *propval;
     svn_revnum_t set_rev;
     SVN_JNI_ERR(svn_client_url_from_path2(&URL, intPath.c_str(), ctx,
-                                          requestPool.pool(),
-                                          requestPool.pool()),
+                                          subPool.pool(),
+                                          subPool.pool()),
                 NULL);
 
     if (URL == NULL)
@@ -1171,7 +1171,7 @@ jbyteArray SVNClient::revProperty(const 
 
     SVN_JNI_ERR(svn_client_revprop_get(name, &propval, URL,
                                        rev.revision(), &set_rev, ctx,
-                                       requestPool.pool()),
+                                       subPool.pool()),
                 NULL);
     if (propval == NULL)
         return NULL;
@@ -1182,26 +1182,26 @@ jbyteArray SVNClient::revProperty(const 
 void SVNClient::relocate(const char *from, const char *to, const char *path,
                          bool ignoreExternals)
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
     SVN_JNI_NULL_PTR_EX(path, "path", );
     SVN_JNI_NULL_PTR_EX(from, "from", );
     SVN_JNI_NULL_PTR_EX(to, "to", );
-    Path intPath(path);
+    Path intPath(path, subPool);
     SVN_JNI_ERR(intPath.error_occured(), );
 
-    Path intFrom(from);
+    Path intFrom(from, subPool);
     SVN_JNI_ERR(intFrom.error_occured(), );
 
-    Path intTo(to);
+    Path intTo(to, subPool);
     SVN_JNI_ERR(intTo.error_occured(), );
 
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     if (ctx == NULL)
         return;
 
     SVN_JNI_ERR(svn_client_relocate2(intPath.c_str(), intFrom.c_str(),
                                      intTo.c_str(), ignoreExternals, ctx,
-                                     requestPool.pool()), );
+                                     subPool.pool()), );
 }
 
 void SVNClient::blame(const char *path, Revision &pegRevision,
@@ -1209,13 +1209,13 @@ void SVNClient::blame(const char *path, 
                       bool ignoreMimeType, bool includeMergedRevisions,
                       BlameCallback *callback)
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
     SVN_JNI_NULL_PTR_EX(path, "path", );
-    apr_pool_t *pool = requestPool.pool();
-    Path intPath(path);
+    apr_pool_t *pool = subPool.pool();
+    Path intPath(path, subPool);
     SVN_JNI_ERR(intPath.error_occured(), );
 
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     if (ctx == NULL)
         return;
 
@@ -1232,29 +1232,29 @@ void SVNClient::blame(const char *path, 
 void SVNClient::addToChangelist(Targets &srcPaths, const char *changelist,
                                 svn_depth_t depth, StringArray &changelists)
 {
-    SVN::Pool requestPool;
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    SVN::Pool subPool(pool);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
 
-    const apr_array_header_t *srcs = srcPaths.array(requestPool);
+    const apr_array_header_t *srcs = srcPaths.array(subPool);
     SVN_JNI_ERR(srcPaths.error_occured(), );
 
     SVN_JNI_ERR(svn_client_add_to_changelist(srcs, changelist, depth,
-                                             changelists.array(requestPool),
-                                             ctx, requestPool.pool()), );
+                                             changelists.array(subPool),
+                                             ctx, subPool.pool()), );
 }
 
 void SVNClient::removeFromChangelists(Targets &srcPaths, svn_depth_t depth,
                                       StringArray &changelists)
 {
-    SVN::Pool requestPool;
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    SVN::Pool subPool(pool);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
 
-    const apr_array_header_t *srcs = srcPaths.array(requestPool);
+    const apr_array_header_t *srcs = srcPaths.array(subPool);
     SVN_JNI_ERR(srcPaths.error_occured(), );
 
     SVN_JNI_ERR(svn_client_remove_from_changelists(srcs, depth,
-                                                changelists.array(requestPool),
-                                                ctx, requestPool.pool()), );
+                                                changelists.array(subPool),
+                                                ctx, subPool.pool()), );
 }
 
 void SVNClient::getChangelists(const char *rootPath,
@@ -1262,56 +1262,56 @@ void SVNClient::getChangelists(const cha
                                svn_depth_t depth,
                                ChangelistCallback *callback)
 {
-    SVN::Pool requestPool;
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    SVN::Pool subPool(pool);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
 
     SVN_JNI_ERR(svn_client_get_changelists(rootPath,
-                                           changelists.array(requestPool),
+                                           changelists.array(subPool),
                                            depth, ChangelistCallback::callback,
-                                           callback, ctx, requestPool.pool()),
+                                           callback, ctx, subPool.pool()),
                 );
 }
 
 void SVNClient::lock(Targets &targets, const char *comment, bool force)
 {
-    SVN::Pool requestPool;
-    const apr_array_header_t *targetsApr = targets.array(requestPool);
+    SVN::Pool subPool(pool);
+    const apr_array_header_t *targetsApr = targets.array(subPool);
     SVN_JNI_ERR(targets.error_occured(), );
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
 
     SVN_JNI_ERR(svn_client_lock(targetsApr, comment, force, ctx,
-                                requestPool.pool()), );
+                                subPool.pool()), );
 }
 
 void SVNClient::unlock(Targets &targets, bool force)
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
 
-    const apr_array_header_t *targetsApr = targets.array(requestPool);
+    const apr_array_header_t *targetsApr = targets.array(subPool);
     SVN_JNI_ERR(targets.error_occured(), );
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     SVN_JNI_ERR(svn_client_unlock((apr_array_header_t*)targetsApr, force,
-                                  ctx, requestPool.pool()), );
+                                  ctx, subPool.pool()), );
 }
 void SVNClient::setRevProperty(const char *path,
                                const char *name, Revision &rev,
                                const char *value, const char *original_value,
                                bool force)
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
     SVN_JNI_NULL_PTR_EX(path, "path", );
     SVN_JNI_NULL_PTR_EX(name, "name", );
-    Path intPath(path);
+    Path intPath(path, subPool);
     SVN_JNI_ERR(intPath.error_occured(), );
 
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     if (ctx == NULL)
         return;
 
     const char *URL;
     SVN_JNI_ERR(svn_client_url_from_path2(&URL, intPath.c_str(), ctx,
-                                          requestPool.pool(),
-                                          requestPool.pool()), );
+                                          subPool.pool(),
+                                          subPool.pool()), );
 
     if (URL == NULL)
     {
@@ -1320,41 +1320,41 @@ void SVNClient::setRevProperty(const cha
             );
     }
 
-    svn_string_t *val = svn_string_create(value, requestPool.pool());
+    svn_string_t *val = svn_string_create(value, subPool.pool());
     svn_string_t *orig_val;
     if (original_value != NULL)
-      orig_val = svn_string_create(original_value, requestPool.pool());
+      orig_val = svn_string_create(original_value, subPool.pool());
     else
       orig_val = NULL;
 
     svn_revnum_t set_revision;
     SVN_JNI_ERR(svn_client_revprop_set2(name, val, orig_val, URL, rev.revision(),
                                         &set_revision, force, ctx,
-                                        requestPool.pool()), );
+                                        subPool.pool()), );
 }
 
 jstring SVNClient::getVersionInfo(const char *path, const char *trailUrl,
                                   bool lastChanged)
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
     SVN_JNI_NULL_PTR_EX(path, "path", NULL);
 
-    Path intPath(path);
+    Path intPath(path, subPool);
     SVN_JNI_ERR(intPath.error_occured(), NULL);
 
     int wc_format;
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     if (ctx == NULL)
         return NULL;
     SVN_JNI_ERR(svn_wc_check_wc2(&wc_format, ctx->wc_ctx, intPath.c_str(),
-                                 requestPool.pool()),
+                                 subPool.pool()),
                 NULL);
 
     if (! wc_format)
     {
         svn_node_kind_t kind;
         SVN_JNI_ERR(svn_io_check_path(intPath.c_str(), &kind,
-                                      requestPool.pool()),
+                                      subPool.pool()),
                     NULL);
         if (kind == svn_node_dir)
         {
@@ -1373,12 +1373,12 @@ jstring SVNClient::getVersionInfo(const 
     const char *local_abspath;
 
     SVN_JNI_ERR(svn_dirent_get_absolute(&local_abspath, intPath.c_str(),
-                                        requestPool.pool()), NULL);
+                                        subPool.pool()), NULL);
     SVN_JNI_ERR(svn_wc_revision_status2(&result, ctx->wc_ctx, local_abspath,
                                         trailUrl, lastChanged,
                                         ctx->cancel_func, ctx->cancel_baton,
-                                        requestPool.pool(),
-                                        requestPool.pool()), NULL);
+                                        subPool.pool(),
+                                        subPool.pool()), NULL);
 
     std::ostringstream value;
     value << result->min_rev;
@@ -1399,40 +1399,40 @@ jstring SVNClient::getVersionInfo(const 
 
 void SVNClient::upgrade(const char *path)
 {
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
     SVN_JNI_NULL_PTR_EX(path, "path", );
 
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     if (ctx == NULL)
         return;
 
-    Path checkedPath(path);
+    Path checkedPath(path, subPool);
     SVN_JNI_ERR(checkedPath.error_occured(), );
 
-    SVN_JNI_ERR(svn_client_upgrade(path, ctx, requestPool.pool()), );
+    SVN_JNI_ERR(svn_client_upgrade(path, ctx, subPool.pool()), );
 }
 
 jobject SVNClient::revProperties(const char *path, Revision &revision)
 {
     apr_hash_t *props;
-    SVN::Pool requestPool;
+    SVN::Pool subPool(pool);
     SVN_JNI_NULL_PTR_EX(path, "path", NULL);
-    Path intPath(path);
+    Path intPath(path, subPool);
     SVN_JNI_ERR(intPath.error_occured(), NULL);
 
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     const char *URL;
     svn_revnum_t set_rev;
     SVN_JNI_ERR(svn_client_url_from_path2(&URL, intPath.c_str(), ctx,
-                                          requestPool.pool(),
-                                          requestPool.pool()),
+                                          subPool.pool(),
+                                          subPool.pool()),
                 NULL);
 
     if (ctx == NULL)
         return NULL;
 
     SVN_JNI_ERR(svn_client_revprop_list(&props, URL, revision.revision(),
-                                        &set_rev, ctx, requestPool.pool()),
+                                        &set_rev, ctx, subPool.pool()),
                 NULL);
 
     return CreateJ::PropertyMap(props);
@@ -1451,21 +1451,21 @@ SVNClient::info2(const char *path, Revis
 {
     SVN_JNI_NULL_PTR_EX(path, "path", );
 
-    SVN::Pool requestPool;
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    SVN::Pool subPool(pool);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     if (ctx == NULL)
         return;
 
-    Path checkedPath(path);
+    Path checkedPath(path, subPool);
     SVN_JNI_ERR(checkedPath.error_occured(), );
 
     SVN_JNI_ERR(svn_client_info3(checkedPath.c_str(),
                                  pegRevision.revision(),
                                  revision.revision(),
                                  depth, FALSE, TRUE,
-                                 changelists.array(requestPool),
+                                 changelists.array(subPool),
                                  InfoCallback::callback, callback,
-                                 ctx, requestPool.pool()), );
+                                 ctx, subPool.pool()), );
 }
 
 void
@@ -1476,14 +1476,14 @@ SVNClient::patch(const char *patchPath, 
     SVN_JNI_NULL_PTR_EX(patchPath, "patchPath", );
     SVN_JNI_NULL_PTR_EX(targetPath, "targetPath", );
 
-    SVN::Pool requestPool;
-    svn_client_ctx_t *ctx = context.getContext(NULL);
+    SVN::Pool subPool(pool);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
     if (ctx == NULL)
         return;
 
-    Path checkedPatchPath(patchPath);
+    Path checkedPatchPath(patchPath, subPool);
     SVN_JNI_ERR(checkedPatchPath.error_occured(), );
-    Path checkedTargetPath(targetPath);
+    Path checkedTargetPath(targetPath, subPool);
     SVN_JNI_ERR(checkedTargetPath.error_occured(), );
 
     // Should parameterize the following, instead of defaulting to FALSE
@@ -1492,7 +1492,7 @@ SVNClient::patch(const char *patchPath, 
                                  dryRun, stripCount, reverse,
                                  ignoreWhitespace, removeTempfiles,
                                  PatchCallback::callback, callback,
-                                 ctx, requestPool.pool()), );
+                                 ctx, subPool.pool()), );
 }
 
 ClientContext &

Modified: subversion/trunk/subversion/bindings/javahl/native/Targets.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/Targets.cpp?rev=1154144&r1=1154143&r2=1154144&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/Targets.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/Targets.cpp Fri Aug  5 09:38:42 2011
@@ -36,10 +36,11 @@ Targets::~Targets()
 {
 }
 
-Targets::Targets(const char *path)
+Targets::Targets(const char *path, SVN::Pool &in_pool)
+    : m_subpool(in_pool)
 {
   m_strArray = NULL;
-  m_targets.push_back (path);
+  m_targets.push_back (apr_pstrdup(m_subpool.pool(), path));
   m_error_occured = NULL;
 }
 
@@ -68,7 +69,7 @@ const apr_array_header_t *Targets::array
         }
     }
 
-  std::vector<Path>::const_iterator it;
+  std::vector<const char*>::const_iterator it;
 
   apr_pool_t *apr_pool = pool.pool ();
   apr_array_header_t *apr_targets = apr_array_make (apr_pool,
@@ -77,16 +78,22 @@ const apr_array_header_t *Targets::array
 
   for (it = m_targets.begin(); it != m_targets.end(); ++it)
     {
-      const Path &path = *it;
-      const char *target =
-        apr_pstrdup (apr_pool, path.c_str());
-      (*((const char **) apr_array_push (apr_targets))) = target;
+      const char *target = *it;
+
+      svn_error_t *err = JNIUtil::preprocessPath(target, pool.pool());
+      if (err != NULL)
+        {
+            m_error_occured = err;
+            break;
+        }
+      APR_ARRAY_PUSH(apr_targets, const char *) = *it;
     }
 
   return apr_targets;
 }
 
-Targets::Targets(StringArray &strArray)
+Targets::Targets(StringArray &strArray, SVN::Pool &in_pool)
+    : m_subpool(in_pool)
 {
   m_strArray = &strArray;
   m_error_occured = NULL;

Modified: subversion/trunk/subversion/bindings/javahl/native/Targets.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/Targets.h?rev=1154144&r1=1154143&r2=1154144&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/Targets.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/Targets.h Fri Aug  5 09:38:42 2011
@@ -34,17 +34,19 @@
 struct apr_array_header_t;
 
 #include "Path.h"
+#include "Pool.h"
 #include <vector>
 
 class Targets
 {
  private:
-  std::vector<Path> m_targets;
+  SVN::Pool m_subpool;
+  std::vector<const char*> m_targets;
   StringArray *m_strArray;
   svn_error_t *m_error_occured;
  public:
-  Targets(StringArray &strArray);
-  Targets(const char *path);
+  Targets(StringArray &strArray, SVN::Pool &in_pool);
+  Targets(const char *path, SVN::Pool &in_pool);
   void add(const char *path);
   ~Targets();
   const apr_array_header_t *array(const SVN::Pool &pool);

Modified: subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp?rev=1154144&r1=1154143&r2=1154144&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp Fri Aug  5 09:38:42 2011
@@ -356,8 +356,9 @@ Java_org_apache_subversion_javahl_SVNCli
       JNIUtil::throwError(_("bad C++ this"));
       return;
     }
+  SVN::Pool tmpPool;
   StringArray targetsArr(jtargets);
-  Targets targets(targetsArr);
+  Targets targets(targetsArr, tmpPool);
   if (JNIUtil::isExceptionThrown())
     return;
 
@@ -434,8 +435,9 @@ Java_org_apache_subversion_javahl_SVNCli
   if (JNIUtil::isExceptionThrown())
     return NULL;
 
+  SVN::Pool tmpPool;
   StringArray targetsArr(jtargets);
-  Targets targets(targetsArr);
+  Targets targets(targetsArr, tmpPool);
   if (JNIUtil::isExceptionThrown())
     return NULL;
 
@@ -459,8 +461,9 @@ Java_org_apache_subversion_javahl_SVNCli
       JNIUtil::throwError(_("bad C++ this"));
       return;
     }
+  SVN::Pool tmpPool;
   StringArray targetsArr(jtargets);
-  Targets targets(targetsArr);
+  Targets targets(targetsArr, tmpPool);
   if (JNIUtil::isExceptionThrown())
     return;
 
@@ -538,8 +541,9 @@ Java_org_apache_subversion_javahl_SVNCli
       JNIUtil::throwError(_("bad C++ this"));
       return;
     }
+  SVN::Pool tmpPool;
   StringArray srcPathArr(jsrcPaths);
-  Targets srcPaths(srcPathArr);
+  Targets srcPaths(srcPathArr, tmpPool);
   if (JNIUtil::isExceptionThrown())
     return;
   JNIStringHolder destPath(jdestPath);
@@ -572,8 +576,9 @@ Java_org_apache_subversion_javahl_SVNCli
       JNIUtil::throwError(_("bad C++ this"));
       return;
     }
+  SVN::Pool tmpPool;
   StringArray targetsArr(jtargets);
-  Targets targets(targetsArr);
+  Targets targets(targetsArr, tmpPool);
   if (JNIUtil::isExceptionThrown())
     return;
 
@@ -960,8 +965,9 @@ Java_org_apache_subversion_javahl_SVNCli
       JNIUtil::throwError(_("bad C++ this"));
       return;
     }
+  SVN::Pool tmpPool;
   StringArray targetsArr(jtargets);
-  Targets targets(targetsArr);
+  Targets targets(targetsArr, tmpPool);
   if (JNIUtil::isExceptionThrown())
     return;
 
@@ -1575,8 +1581,9 @@ Java_org_apache_subversion_javahl_SVNCli
       JNIUtil::throwError("bad C++ this");
       return;
     }
+  SVN::Pool tmpPool;
   StringArray targetsArr(jtargets);
-  Targets targets(targetsArr);
+  Targets targets(targetsArr, tmpPool);
   if (JNIUtil::isExceptionThrown())
     return;
 
@@ -1604,8 +1611,9 @@ Java_org_apache_subversion_javahl_SVNCli
       JNIUtil::throwError("bad C++ this");
       return;
     }
+  SVN::Pool tmpPool;
   StringArray targetsArr(jtargets);
-  Targets targets(targetsArr);
+  Targets targets(targetsArr, tmpPool);
   if (JNIUtil::isExceptionThrown())
     return;
 
@@ -1654,8 +1662,9 @@ Java_org_apache_subversion_javahl_SVNCli
       JNIUtil::throwError("bad C++ this");
       return;
     }
+  SVN::Pool tmpPool;
   StringArray targetsArr(jtargets);
-  Targets targets(targetsArr);
+  Targets targets(targetsArr, tmpPool);
   if (JNIUtil::isExceptionThrown())
     return;
 
@@ -1678,8 +1687,9 @@ Java_org_apache_subversion_javahl_SVNCli
       return;
     }
 
+  SVN::Pool tmpPool;
   StringArray targetsArr(jtargets);
-  Targets targets(targetsArr);
+  Targets targets(targetsArr, tmpPool);
   if (JNIUtil::isExceptionThrown())
     return;