diff --git a/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.hpp b/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.hpp index 5b198c96015..2d9b6f13d5a 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.hpp @@ -694,6 +694,7 @@ public: // Return an approximation of the bytes allocated since GC start. The value returned is monotonically non-decreasing // in time within each GC cycle. For certain GC cycles, the value returned may include some bytes allocated before // the start of the current GC cycle. + // Bytes allocated since gc start includes the total unused bytes in mutator allocator reserved for CAS allocation. inline size_t get_bytes_allocated_since_gc_start() const { return _mutator_bytes_allocated_since_gc_start; } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp index fec24747efc..c5574393324 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp @@ -2293,6 +2293,7 @@ void ShenandoahHeap::reset_bytes_allocated_since_gc_start() { // Single-gen Shenandoah uses global heuristics. unaccounted_bytes = heuristics()->force_alloc_rate_sample(actual_allocated); } + // Bytes allocated since gc start includes the total unused bytes in mutator allocator reserved for CAS allocation. _free_set->reset_bytes_allocated_since_gc_start(unaccounted_bytes + mutator_allocator_remaining_bytes); }