Skip to content

Commit

Permalink
8314573: G1: Heap resizing at Remark does not take existing eden regi…
Browse files Browse the repository at this point in the history
…ons into account

Backport-of: 762b652
  • Loading branch information
Liang Mao authored and zhengyu123 committed May 7, 2024
1 parent 41fda4a commit 93d091a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/hotspot/share/gc/g1/g1HeapSizingPolicy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,14 @@ size_t G1HeapSizingPolicy::full_collection_resize_amount(bool& expand) {
// Capacity, free and used after the GC counted as full regions to
// include the waste in the following calculations.
const size_t capacity_after_gc = _g1h->capacity();
const size_t used_after_gc = capacity_after_gc - _g1h->unused_committed_regions_in_bytes();
const size_t used_after_gc = capacity_after_gc -
_g1h->unused_committed_regions_in_bytes() -
// Discount space used by current Eden to establish a
// situation during Remark similar to at the end of full
// GC where eden is empty. During Remark there can be an
// arbitrary number of eden regions which would skew the
// results.
_g1h->eden_regions_count() * HeapRegion::GrainBytes;

size_t minimum_desired_capacity = target_heap_capacity(used_after_gc, MinHeapFreeRatio);
size_t maximum_desired_capacity = target_heap_capacity(used_after_gc, MaxHeapFreeRatio);
Expand Down

0 comments on commit 93d091a

Please sign in to comment.