Skip to content

Commit 7ae30cb

Browse files
ulanCommit Bot
authored andcommitted
[heap] Skip memory reducer on AdjustAmountOfExternalAllocateMemory
V8 performs GC based on external memory limit. Additionally triggering memory reducing GCs may be problematic for large heaps and increases the chances of multiple V8 isolates performing GCs after IsolateInBackgroundNotification. Bug: chromium:1072746 Change-Id: I7649a176504803ba666e6367b008593bbcfe6312 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2159488 Commit-Queue: Ulan Degenbaev <[email protected]> Reviewed-by: Michael Lippautz <[email protected]> Reviewed-by: Hannes Payer <[email protected]> Cr-Commit-Position: refs/heads/master@{#67398}
1 parent 804112e commit 7ae30cb

2 files changed

Lines changed: 3 additions & 19 deletions

File tree

include/v8.h

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
#include <utility>
2525
#include <vector>
2626

27-
#include "v8-internal.h" // NOLINT(build/include)
28-
#include "v8-version.h" // NOLINT(build/include)
29-
#include "v8config.h" // NOLINT(build/include)
27+
#include "v8-internal.h" // NOLINT(build/include_directory)
28+
#include "v8-version.h" // NOLINT(build/include_directory)
29+
#include "v8config.h" // NOLINT(build/include_directory)
3030

3131
// We reserve the V8_* prefix for macros defined in V8 public API and
3232
// assume there are no name conflicts with the embedder's code.
@@ -9530,7 +9530,6 @@ class V8_EXPORT Isolate {
95309530

95319531
internal::Address* GetDataFromSnapshotOnce(size_t index);
95329532
void ReportExternalAllocationLimitReached();
9533-
void CheckMemoryPressure();
95349533
};
95359534

95369535
class V8_EXPORT StartupData {
@@ -11968,7 +11967,6 @@ MaybeLocal<T> Isolate::GetDataFromSnapshotOnce(size_t index) {
1196811967
int64_t Isolate::AdjustAmountOfExternalAllocatedMemory(
1196911968
int64_t change_in_bytes) {
1197011969
typedef internal::Internals I;
11971-
constexpr int64_t kMemoryReducerActivationLimit = 32 * 1024 * 1024;
1197211970
int64_t* external_memory = reinterpret_cast<int64_t*>(
1197311971
reinterpret_cast<uint8_t*>(this) + I::kExternalMemoryOffset);
1197411972
int64_t* external_memory_limit = reinterpret_cast<int64_t*>(
@@ -11991,14 +11989,6 @@ int64_t Isolate::AdjustAmountOfExternalAllocatedMemory(
1199111989

1199211990
if (change_in_bytes <= 0) return *external_memory;
1199311991

11994-
int64_t allocation_diff_since_last_mc = static_cast<int64_t>(
11995-
static_cast<uint64_t>(*external_memory) -
11996-
static_cast<uint64_t>(*external_memory_low_since_mc));
11997-
// Only check memory pressure and potentially trigger GC if the amount of
11998-
// external memory increased.
11999-
if (allocation_diff_since_last_mc > kMemoryReducerActivationLimit) {
12000-
CheckMemoryPressure();
12001-
}
1200211992
if (amount > *external_memory_limit) {
1200311993
ReportExternalAllocationLimitReached();
1200411994
}

src/api/api.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8038,12 +8038,6 @@ void Isolate::ReportExternalAllocationLimitReached() {
80388038
heap->ReportExternalMemoryPressure();
80398039
}
80408040

8041-
void Isolate::CheckMemoryPressure() {
8042-
i::Heap* heap = reinterpret_cast<i::Isolate*>(this)->heap();
8043-
if (heap->gc_state() != i::Heap::NOT_IN_GC) return;
8044-
heap->CheckMemoryPressure();
8045-
}
8046-
80478041
HeapProfiler* Isolate::GetHeapProfiler() {
80488042
i::HeapProfiler* heap_profiler =
80498043
reinterpret_cast<i::Isolate*>(this)->heap_profiler();

0 commit comments

Comments
 (0)