couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cml...@apache.org
Subject svn commit: r642448 - /incubator/couchdb/trunk/src/couchdb/couch_js.c
Date Sat, 29 Mar 2008 00:15:05 GMT
Author: cmlenz
Date: Fri Mar 28 17:15:02 2008
New Revision: 642448

URL: http://svn.apache.org/viewvc?rev=642448&view=rev
Log:
Remove branch limit and fix memory leak in Javascript view server. Fixes issue COUCHDB-25.

Modified:
    incubator/couchdb/trunk/src/couchdb/couch_js.c

Modified: incubator/couchdb/trunk/src/couchdb/couch_js.c
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/src/couchdb/couch_js.c?rev=642448&r1=642447&r2=642448&view=diff
==============================================================================
--- incubator/couchdb/trunk/src/couchdb/couch_js.c (original)
+++ incubator/couchdb/trunk/src/couchdb/couch_js.c Fri Mar 28 17:15:02 2008
@@ -335,12 +335,12 @@
         JS_free(context, chars);
         return JS_FALSE;
     }
+    JS_free(context, bytes);
     chars[charslen] = '\0';
 
     /* Initialize a JSString object */
     str = JS_NewUCString(context, chars, charslen - 1);
     if (!str) {
-        JS_free(context, bytes);
         JS_free(context, chars);
         return JS_FALSE;
     }
@@ -386,15 +386,10 @@
 }
 
 static uint32 gBranchCount = 0;
-static uint32 gBranchLimit = 100 * 1024;
 
 static JSBool
 BranchCallback(JSContext *context, JSScript *script) {
-    if (++gBranchCount == gBranchLimit) {
-        gBranchCount = 0;
-        return JS_FALSE;
-    }
-    if ((gBranchCount & 0x3fff) == 1) {
+    if ((++gBranchCount & 0x3fff) == 1) {
         JS_MaybeGC(context);
     }
     return JS_TRUE;



Mime
View raw message