summaryrefslogtreecommitdiff
path: root/src/mongo/scripting/mozjs/jscustomallocator.cpp
diff options
context:
space:
mode:
authorJason Carey <jcarey@argv.me>2015-12-01 15:33:32 -0500
committerJason Carey <jcarey@argv.me>2015-12-02 11:48:08 -0500
commitaddf42317b9e9a88d22dad86470b206c25d2ea5f (patch)
tree4aab549fcd58c5175e9b4a0c0cadc4e5f6c9dbab /src/mongo/scripting/mozjs/jscustomallocator.cpp
parentf397859e7e76882aee534350fa04e6c621c6ec53 (diff)
downloadmongo-addf42317b9e9a88d22dad86470b206c25d2ea5f.tar.gz
SERVER-21717 Be more graceful in JS OOM
rather than return null to spidermonkey, just request that we bail out as soon as possible.
Diffstat (limited to 'src/mongo/scripting/mozjs/jscustomallocator.cpp')
-rw-r--r--src/mongo/scripting/mozjs/jscustomallocator.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mongo/scripting/mozjs/jscustomallocator.cpp b/src/mongo/scripting/mozjs/jscustomallocator.cpp
index adba220129d..a817d2a8cad 100644
--- a/src/mongo/scripting/mozjs/jscustomallocator.cpp
+++ b/src/mongo/scripting/mozjs/jscustomallocator.cpp
@@ -118,7 +118,9 @@ void* wrap_alloc(T&& func, void* ptr, size_t bytes) {
scope->setOOM();
- return nullptr;
+ // We fall through here because we want to let spidermonkey continue
+ // with whatever it was doing. Calling setOOM will fail the top level
+ // operation as soon as possible.
}
#ifdef MONGO_NO_MALLOC_USABLE_SIZE