Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Unified Diff: src/api.cc

Issue 2424393002: Constrain the zone segment pool size (Closed)
Patch Set: Fixed overflow Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index aed4af089b7c5b1eeb79194fa1622feba4c0daee..920163169d58df1938a818a118ff60f3df8ebf91 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -744,6 +744,14 @@ void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory,
i::Min(i::kMaximalCodeRangeSize / i::MB,
static_cast<size_t>((virtual_memory_limit >> 3) / i::MB)));
}
+
+ if (physical_memory <= 512ul * i::MB) {
Michael Lippautz 2016/10/18 14:50:22 Use the categories already defined above, starting
+ set_max_pool_size(8ul * i::KB);
+ } else if (physical_memory <= i::GB) {
+ set_max_pool_size(i::MB);
+ } else {
+ set_max_pool_size(3ul * i::MB);
+ }
}
@@ -753,11 +761,14 @@ void SetResourceConstraints(i::Isolate* isolate,
int old_space_size = constraints.max_old_space_size();
int max_executable_size = constraints.max_executable_size();
size_t code_range_size = constraints.code_range_size();
+ size_t max_pool_size = constraints.max_pool_size();
if (semi_space_size != 0 || old_space_size != 0 ||
max_executable_size != 0 || code_range_size != 0) {
isolate->heap()->ConfigureHeap(semi_space_size, old_space_size,
max_executable_size, code_range_size);
}
+ isolate->allocator()->ConfigureSegmentPool(max_pool_size);
+
if (constraints.stack_limit() != NULL) {
uintptr_t limit = reinterpret_cast<uintptr_t>(constraints.stack_limit());
isolate->stack_guard()->SetStackLimit(limit);
« include/v8.h ('K') | « include/v8.h ('k') | src/zone/accounting-allocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698