harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r576826 - /harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/process.c
Date Tue, 18 Sep 2007 10:28:21 GMT
Author: hindessm
Date: Tue Sep 18 03:28:20 2007
New Revision: 576826

URL: http://svn.apache.org/viewvc?rev=576826&view=rev
Log:
Delete the local references created by GetObjectArrayElement to avoid
growing the local reference frame capacity.  (The env array is often
fairly large so the frame capacity would grow excessively - from 16
references to 1k references was quite common in my testing.  The default
16 references are now sufficient.)

Also, moved envString variable declaration to more appropriate scope.
It is now more consistent with the scope of the element variable in
the earlier loop.

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/process.c

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/process.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/process.c?rev=576826&r1=576825&r2=576826&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/process.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/process.c Tue
Sep 18 03:28:20 2007
@@ -32,7 +32,6 @@
             jobjectArray arg2,
             jbyteArray dir)
 {
-  jbyteArray envString;
   jlongArray pVals = NULL;
   jlong npVals[4];
   char *envArray[256];
@@ -74,11 +73,12 @@
         }
       (*env)->GetByteArrayRegion (env, element, 0, len, (jbyte *)command[i]);
       command[i][len] = 0;
+      (*env)->DeleteLocalRef(env, element);
     }
   if (envLength)
     for (i = 0; i < envLength; i++)
       {
-        envString = (*env)->GetObjectArrayElement (env, arg2, i);
+        jbyteArray envString = (*env)->GetObjectArrayElement (env, arg2, i);
         len = (*env)->GetArrayLength (env, envString);
         envArray[i] = jclmem_allocate_memory (env, len + 1);
         if (envArray[i] == NULL)
@@ -88,6 +88,7 @@
           }
         (*env)->GetByteArrayRegion (env, envString, 0, len, (jbyte *)envArray[i]);
         envArray[i][len] = 0;
+        (*env)->DeleteLocalRef(env, envString);
       }
   /* NULL terminate for UNIX (does work on windows too; in fact, it doesn't care) */
   command[commandLineLength] = NULL;



Mime
View raw message