Commit 01ce70a2 authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

[heap] Use forced flags for LowMemoryNotification

The notification is only used for testing and benchmarking purposes.
Announcing low memory is usually done using MemoryPressure API.

Bug: chromium:843903
Change-Id: I998018f7f5f3a0d06283aa6010228a9c86f12c39
Reviewed-on: https://chromium-review.googlesource.com/c/1269037Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56454}
parent 8f8b5f8c
......@@ -1124,9 +1124,12 @@ void Heap::CollectAllAvailableGarbage(GarbageCollectionReason gc_reason) {
isolate_->compilation_cache()->Clear();
const int kMaxNumberOfAttempts = 7;
const int kMinNumberOfAttempts = 2;
const v8::GCCallbackFlags callback_flags =
gc_reason == GarbageCollectionReason::kLowMemoryNotification
? v8::kGCCallbackFlagForced
: v8::kGCCallbackFlagCollectAllAvailableGarbage;
for (int attempt = 0; attempt < kMaxNumberOfAttempts; attempt++) {
if (!CollectGarbage(OLD_SPACE, gc_reason,
v8::kGCCallbackFlagCollectAllAvailableGarbage) &&
if (!CollectGarbage(OLD_SPACE, gc_reason, callback_flags) &&
attempt + 1 >= kMinNumberOfAttempts) {
break;
}
......
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