diff options
author | Anna Henningsen <anna@addaleax.net> | 2016-09-10 18:21:20 +0200 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2017-11-14 13:57:35 -0500 |
commit | e18df46092624980a0218982af757a0743cf1d98 (patch) | |
tree | 14b26cee5700fa86ba236e08a6ec906f2930f597 /src/node.cc | |
parent | 6a0eb9f6cfbe3c76a3508418997de7ab2becd4b5 (diff) | |
download | node-new-e18df46092624980a0218982af757a0743cf1d98.tar.gz |
src: notify V8 for low memory when alloc fails
Call `v8::Isolate::GetCurrent()->LowMemoryNotification()` when
an allocation fails to give V8 a chance to clean up and return
memory before retrying (and possibly giving up).
Backport-PR-URL: https://github.com/nodejs/node/pull/16587
PR-URL: https://github.com/nodejs/node/pull/8482
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Diffstat (limited to 'src/node.cc')
-rw-r--r-- | src/node.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/node.cc b/src/node.cc index 6345abdb31..98fde0dbbe 100644 --- a/src/node.cc +++ b/src/node.cc @@ -198,6 +198,7 @@ bool trace_warnings = false; // that is used by lib/module.js bool config_preserve_symlinks = false; +bool v8_initialized = false; // Set in node.cc by ParseArgs when --expose-internals or --expose_internals is // used. @@ -4895,6 +4896,7 @@ int Start(int argc, char** argv) { v8_platform.Initialize(v8_thread_pool_size); V8::Initialize(); + v8_initialized = true; int exit_code = 1; { @@ -4908,6 +4910,7 @@ int Start(int argc, char** argv) { StartNodeInstance(&instance_data); exit_code = instance_data.exit_code(); } + v8_initialized = false; V8::Dispose(); v8_platform.Dispose(); |