Commit d80100b9 authored by Ulan Degenbaev's avatar Ulan Degenbaev Committed by Commit Bot

[heap] Cap the initial old generation size

Currently the initial old generation size is set to the half of the
maximum old generation size. This is problematic for huge heaps.
This patch introduces an upper bound of 512MB (256MB) for x64 (x32).

Bug: chromium:961272
Change-Id: If4a6b839ebe688e5b0bc41749ac34f7a31849e21
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1605731
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: 's avatarHannes Payer <hpayer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61515}
parent 58fea9c1
......@@ -178,8 +178,8 @@ Heap::Heap()
: isolate_(isolate()),
initial_max_old_generation_size_(max_old_generation_size_),
initial_max_old_generation_size_threshold_(0),
initial_old_generation_size_(max_old_generation_size_ /
kInitalOldGenerationLimitFactor),
initial_old_generation_size_(
Min(max_old_generation_size_, kMaxInitialOldGenerationSize)),
memory_pressure_level_(MemoryPressureLevel::kNone),
old_generation_allocation_limit_(initial_old_generation_size_),
global_pretenuring_feedback_(kInitialFeedbackCapacity),
......@@ -4241,7 +4241,7 @@ void Heap::ConfigureHeap(size_t max_semi_space_size_in_kb,
initial_old_generation_size_ = FLAG_initial_old_space_size * MB;
} else {
initial_old_generation_size_ =
max_old_generation_size_ / kInitalOldGenerationLimitFactor;
Min(max_old_generation_size_, kMaxInitialOldGenerationSize);
}
old_generation_allocation_limit_ = initial_old_generation_size_;
......
......@@ -235,8 +235,6 @@ class Heap {
};
using Reservation = std::vector<Chunk>;
static const int kInitalOldGenerationLimitFactor = 2;
#if V8_OS_ANDROID
// Don't apply pointer multiplier on Android since it has no swap space and
// should instead adapt it's heap size based on available physical memory.
......@@ -246,6 +244,9 @@ class Heap {
static const int kPointerMultiplier = i::kSystemPointerSize / 4;
#endif
static const size_t kMaxInitialOldGenerationSize =
256 * MB * kPointerMultiplier;
// Semi-space size needs to be a multiple of page size.
static const size_t kMinSemiSpaceSizeInKB = 512 * kPointerMultiplier;
static const size_t kMaxSemiSpaceSizeInKB = 8192 * kPointerMultiplier;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment