From 3a50c708b9bb14c2d9a55c190a4416110f672650 Mon Sep 17 00:00:00 2001 From: Ulan Degenbaev Date: Tue, 28 Apr 2020 10:29:53 +0200 Subject: [PATCH] [heap] Do not schedule follow-up GCs on memory pressure signal Upon receiving a memory pressure signal V8 performs one GC and also schedules three follow-up GCs. This may be problematic for performance if the memory pressure signals are generated periodically. This patch makes V8's memory pressure handler more lightweight by doing only one GC. Bug: chromium:1072746 Change-Id: I242534bd2c27a68188bb5e3a6b4092118c1b486c Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2169930 Reviewed-by: Michael Lippautz Reviewed-by: Hannes Payer Commit-Queue: Ulan Degenbaev Cr-Commit-Position: refs/heads/master@{#67422} --- src/heap/heap.cc | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/heap/heap.cc b/src/heap/heap.cc index 3779674581..b9f8a4e47e 100644 --- a/src/heap/heap.cc +++ b/src/heap/heap.cc @@ -3773,12 +3773,6 @@ void Heap::CheckMemoryPressure() { GarbageCollectionReason::kMemoryPressure); } } - if (memory_reducer_) { - MemoryReducer::Event event; - event.type = MemoryReducer::kPossibleGarbage; - event.time_ms = MonotonicallyIncreasingTimeInMs(); - memory_reducer_->NotifyPossibleGarbage(event); - } } void Heap::CollectGarbageOnMemoryPressure() {