cppgc: Fix DCHECK in statistics collection

Resident set size may be smaller than the recorded size in
StatsCollector due to discarded memory.

Change-Id: I7e052fc4412afc64dc1ed5be6ed7dc9271e6f9d2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3855204
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Commit-Queue: Anton Bikineev <bikineev@chromium.org>
Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82709}
This commit is contained in:
Michael Lippautz 2022-08-24 22:21:48 +02:00 committed by V8 LUCI CQ
parent d75a0eed1c
commit 6ee0e4c4fd
2 changed files with 4 additions and 2 deletions

View File

@ -98,7 +98,7 @@ struct HeapStatistics final {
/** Overall committed amount of memory for the heap. */
size_t committed_size_bytes = 0;
/** Resident amount of memory help by the heap. */
/** Resident amount of memory held by the heap. */
size_t resident_size_bytes = 0;
/** Amount of memory actually used on the heap. */
size_t used_size_bytes = 0;

View File

@ -109,7 +109,9 @@ HeapStatistics HeapStatisticsCollector::CollectDetailedStatistics(
}
}
DCHECK_EQ(heap->stats_collector()->allocated_memory_size(),
// Resident set size may be smaller than the than the recorded size in
// `StatsCollector` due to discarded memory that is tracked on page level.
DCHECK_GE(heap->stats_collector()->allocated_memory_size(),
stats.resident_size_bytes);
return stats;
}