Skip to content

Commit 762b652

Browse files
author
Thomas Schatzl
committed
8314573: G1: Heap resizing at Remark does not take existing eden regions into account
Reviewed-by: kbarrett, ayang
1 parent a4e97aa commit 762b652

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/hotspot/share/gc/g1/g1HeapSizingPolicy.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,14 @@ size_t G1HeapSizingPolicy::full_collection_resize_amount(bool& expand) {
217217
// Capacity, free and used after the GC counted as full regions to
218218
// include the waste in the following calculations.
219219
const size_t capacity_after_gc = _g1h->capacity();
220-
const size_t used_after_gc = capacity_after_gc - _g1h->unused_committed_regions_in_bytes();
220+
const size_t used_after_gc = capacity_after_gc -
221+
_g1h->unused_committed_regions_in_bytes() -
222+
// Discount space used by current Eden to establish a
223+
// situation during Remark similar to at the end of full
224+
// GC where eden is empty. During Remark there can be an
225+
// arbitrary number of eden regions which would skew the
226+
// results.
227+
_g1h->eden_regions_count() * HeapRegion::GrainBytes;
221228

222229
size_t minimum_desired_capacity = target_heap_capacity(used_after_gc, MinHeapFreeRatio);
223230
size_t maximum_desired_capacity = target_heap_capacity(used_after_gc, MaxHeapFreeRatio);

0 commit comments

Comments
 (0)