From 45d947729a0315accb6d4f15a6b06be6d9c19fe7 Mon Sep 17 00:00:00 2001 From: Jason Carey Date: Tue, 1 Dec 2015 15:43:18 -0500 Subject: SERVER-21715 call JS_SetGCParametersBasedOnAvailableMemory Improves gc performance if we indicate to spidermonkey that we have more than 512megs of ram available. --- src/mongo/scripting/mozjs/implscope.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/mongo/scripting') diff --git a/src/mongo/scripting/mozjs/implscope.cpp b/src/mongo/scripting/mozjs/implscope.cpp index 4d9a85eb13a..903b46529ef 100644 --- a/src/mongo/scripting/mozjs/implscope.cpp +++ b/src/mongo/scripting/mozjs/implscope.cpp @@ -260,6 +260,9 @@ MozJSImplScope::MozRuntime::MozRuntime(const MozJSScriptEngine* engine) { // large pages, like 4MB? JS_SetNativeStackQuota(_runtime, available.get() - (64 * 1024)); } + + // The memory limit is in megabytes + JS_SetGCParametersBasedOnAvailableMemory(_runtime, kMallocMemoryLimit / (1024 * 1024)); } _context = JS_NewContext(_runtime, kStackChunkSize); -- cgit v1.2.1