mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 02:17:14 +00:00
[vm] Avoid data race during Dart_IsolateGroupHeapNewUsedMetric.
Precise new-space usage requires looking at all the TLAB pointers and normally only occurs under a GC safepoint. For external queries coarsen the answer to capacity. TEST=g3 Bug: b/324221135 Change-Id: I0e83bbcddba21ddf539fb2afdedf2959cef2c078 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352682 Reviewed-by: Siva Annamalai <asiva@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
parent
974dfa3071
commit
a4072803b3
|
@ -158,7 +158,10 @@ int64_t MetricHeapOldExternal::Value() const {
|
|||
|
||||
int64_t MetricHeapNewUsed::Value() const {
|
||||
ASSERT(isolate_group() == IsolateGroup::Current());
|
||||
return isolate_group()->heap()->UsedInWords(Heap::kNew) * kWordSize;
|
||||
// UsedInWords requires a safepoint to access all the TLAB pointers without a
|
||||
// data race, so coarsen this metric to capacity. Preferable to locking during
|
||||
// new-space allocation.
|
||||
return isolate_group()->heap()->CapacityInWords(Heap::kNew) * kWordSize;
|
||||
}
|
||||
|
||||
int64_t MetricHeapNewCapacity::Value() const {
|
||||
|
|
Loading…
Reference in a new issue