summaryrefslogtreecommitdiff
path: root/src/api/environment.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/environment.cc')
-rw-r--r--src/api/environment.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/api/environment.cc b/src/api/environment.cc
index 22938df37c..e54252824b 100644
--- a/src/api/environment.cc
+++ b/src/api/environment.cc
@@ -80,6 +80,15 @@ void FreeArrayBufferAllocator(ArrayBufferAllocator* allocator) {
Isolate* NewIsolate(ArrayBufferAllocator* allocator, uv_loop_t* event_loop) {
Isolate::CreateParams params;
params.array_buffer_allocator = allocator;
+
+ double total_memory = uv_get_total_memory();
+ if (total_memory > 0) {
+ // V8 defaults to 700MB or 1.4GB on 32 and 64 bit platforms respectively.
+ // This default is based on browser use-cases. Tell V8 to configure the
+ // heap based on the actual physical memory.
+ params.constraints.ConfigureDefaults(total_memory, 0);
+ }
+
#ifdef NODE_ENABLE_VTUNE_PROFILING
params.code_event_handler = vTune::GetVtuneCodeEventHandler();
#endif