8285710: Miscalculation of G1CardSetAllocator unused memory size

Reviewed-by: tschatzl, ayang
This commit is contained in:
dev-tianqixia 2022-05-10 13:43:33 +00:00 committed by Thomas Schatzl
parent 1ca540460c
commit 9835678a86

View File

@ -61,9 +61,8 @@ size_t G1CardSetAllocator::mem_size() const {
}
size_t G1CardSetAllocator::unused_mem_size() const {
uint num_unused_slots = _segmented_array.num_total_slots() -
_segmented_array.num_allocated_slots() -
(uint)_free_slots_list.pending_count();
uint num_unused_slots = (_segmented_array.num_total_slots() - _segmented_array.num_allocated_slots()) +
(uint)_free_slots_list.free_count();
return num_unused_slots * _segmented_array.slot_size();
}