diff options
author | Jason Carey <jcarey@argv.me> | 2015-12-01 15:33:32 -0500 |
---|---|---|
committer | Jason Carey <jcarey@argv.me> | 2015-12-02 11:48:08 -0500 |
commit | addf42317b9e9a88d22dad86470b206c25d2ea5f (patch) | |
tree | 4aab549fcd58c5175e9b4a0c0cadc4e5f6c9dbab /src/mongo/scripting/mozjs/jscustomallocator.cpp | |
parent | f397859e7e76882aee534350fa04e6c621c6ec53 (diff) | |
download | mongo-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.cpp | 4 |
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 |