Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 39631 invoked from network); 18 Sep 2007 10:28:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Sep 2007 10:28:42 -0000 Received: (qmail 6635 invoked by uid 500); 18 Sep 2007 10:28:34 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 6618 invoked by uid 500); 18 Sep 2007 10:28:34 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 6609 invoked by uid 99); 18 Sep 2007 10:28:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Sep 2007 03:28:34 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Sep 2007 10:28:41 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id ACAA61A9838; Tue, 18 Sep 2007 03:28:21 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@harmony.apache.org From: hindessm@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20070918102821.ACAA61A9838@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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;