Index: src/heap.cc |
diff --git a/src/heap.cc b/src/heap.cc |
index 90847cf1ff18610f85a29f6e4a6bb7e50f901500..58ad372c6f06747112ba87b37d771ce95f52ffa6 100644 |
--- a/src/heap.cc |
+++ b/src/heap.cc |
@@ -153,6 +153,15 @@ Heap::Heap() |
max_semispace_size_ = reserved_semispace_size_ = V8_MAX_SEMISPACE_SIZE; |
#endif |
+ intptr_t max_virtual = OS::MaxVirtualMemory(); |
+ |
+ if (max_virtual > 0) { |
+ if (code_range_size_ > 0) { |
+ // Reserve no more than 1/8 of the memory for the code range. |
+ code_range_size_ = Min(code_range_size_, max_virtual >> 3); |
+ } |
+ } |
+ |
memset(roots_, 0, sizeof(roots_[0]) * kRootListLength); |
global_contexts_list_ = NULL; |
mark_compact_collector_.heap_ = this; |