diff options
author | Gabriel Russell <gabriel.russell@mongodb.com> | 2019-03-21 16:04:27 -0400 |
---|---|---|
committer | Gabriel Russell <gabriel.russell@mongodb.com> | 2019-03-25 13:38:17 -0400 |
commit | edfae8af670eafa99e8bb8f6118627761dcab81e (patch) | |
tree | 353fda5525fdb13cb4bfc4b1d75bb4e5b5841395 | |
parent | bcaa4eb01cf9b854c1bdf1ec1278bdabef9ee58c (diff) | |
download | mongo-edfae8af670eafa99e8bb8f6118627761dcab81e.tar.gz |
SERVER-39152 more correctly set JSGC_MAX_BYTES
-rw-r--r-- | src/mongo/scripting/mozjs/implscope.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/mongo/scripting/mozjs/implscope.cpp b/src/mongo/scripting/mozjs/implscope.cpp index 5d3dbb3218e..5b0d05c0d29 100644 --- a/src/mongo/scripting/mozjs/implscope.cpp +++ b/src/mongo/scripting/mozjs/implscope.cpp @@ -80,8 +80,10 @@ const double kInterruptGCThreshold = 0.8; /** * The number of bytes to allocate after which garbage collection is run + * The default is quite low and doesn't seem to directly correlate with + * malloc'd bytes. We bound JS heap usage by JSHeapLimit independent of this GC limit. */ -const int kMaxBytesBeforeGC = 8 * 1024 * 1024; +const int kMaxBytesBeforeGC = 0xffffffff; /** * The size, in bytes, of each "stack chunk". 8192 is the recommended amount @@ -372,8 +374,6 @@ MozJSImplScope::MozRuntime::MozRuntime(const MozJSScriptEngine* engine) { // The memory limit is in megabytes JS_SetGCParametersBasedOnAvailableMemory(_context.get(), engine->getJSHeapLimitMB()); - // TODO SERVER-39152 apply the mozilla patch to stop overriding JSGC_MAX_BYTES - JS_SetGCParameter(_context.get(), JSGC_MAX_BYTES, 0xffffffff); } } @@ -426,11 +426,6 @@ MozJSImplScope::MozJSImplScope(MozJSScriptEngine* engine) _uriProto(_context) { kCurrentScope = this; - // The default is quite low and doesn't seem to directly correlate with - // malloc'd bytes. Set it to MAX_INT here and catching things in the - // jscustomallocator.cpp - JS_SetGCParameter(_context, JSGC_MAX_BYTES, 0xffffffff); - JS_AddInterruptCallback(_context, _interruptCallback); JS_SetGCCallback(_context, _gcCallback, this); JS_SetContextPrivate(_context, this); |