RFR: 8355756: G1HeapSizingPolicy::full_collection_resize_amount should consider allocation size

Thomas Schatzl tschatzl at openjdk.org
Tue Apr 29 10:45:55 UTC 2025


On Tue, 29 Apr 2025 09:02:43 GMT, Ivan Walulya <iwalulya at openjdk.org> wrote:

> Hi,
> 
> Please review this change to account for pending allocations when deciding how much to shrink the heap after a full gc. Otherwise, we shrink the heap only to trigger an expansion to satisfy the allocation request that triggered the full gc.
> 
> Testing: Tier 1-3

src/hotspot/share/gc/g1/g1HeapSizingPolicy.cpp line 239:

> 237:   // unnecessary shrinking that would be followed by an expand call to satisfy the
> 238:   // allocation.
> 239:   size_t allocation_bytes = allocation_word_size * HeapWordSize;

I think we should do better here for humongous allocations: afaict we get the actual object size passed here, but in reality g1 needs to allocate on a full region basis.
I.e. for humongous objects, `allocation_word_size` should be padded.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/24944#discussion_r2066033403


More information about the hotspot-gc-dev mailing list