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

Reviewed-by: kbarrett, ayang
  • Loading branch information
Thomas Schatzl committed Aug 29, 2023
1 parent a4e97aa commit 762b652
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

1 comment on commit 762b652

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.