summaryrefslogtreecommitdiff
path: root/src/couchdb
diff options
context:
space:
mode:
authorChristopher Lenz <cmlenz@apache.org>2008-03-29 00:15:02 +0000
committerChristopher Lenz <cmlenz@apache.org>2008-03-29 00:15:02 +0000
commit3becac5769f5af05be4cc033ab24924f4bd3458c (patch)
tree8fbef43edaf450b2215bd3ffe797a481e44b0399 /src/couchdb
parent8833937e4d390a761c95ef6cce4514883b74503e (diff)
Remove branch limit and fix memory leak in Javascript view server. Fixes issue COUCHDB-25.
git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@642448 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb')
-rw-r--r--src/couchdb/couch_js.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/couchdb/couch_js.c b/src/couchdb/couch_js.c
index a234fda9..8481bc50 100644
--- a/src/couchdb/couch_js.c
+++ b/src/couchdb/couch_js.c
@@ -335,12 +335,12 @@ ReadLine(JSContext *context, JSObject *obj, uintN argc, jsval *argv, jsval *rval
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 @@ ExecuteScript(JSContext *context, JSObject *obj, const char *filename) {
}
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;