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

Ivan Walulya iwalulya at openjdk.org
Wed Apr 30 07:23:45 UTC 2025


On Tue, 29 Apr 2025 15:24:44 GMT, Ivan Walulya <iwalulya at openjdk.org> wrote:

>> 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.
>
> At this point all computation is considering bytes, later in the shrink helper we align_down since the shrinking is done on a region basis. So except for documentation purposes, I don't think we need to do the padding here.

On second look, you are right, we need to pad the humongous.

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

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


More information about the hotspot-gc-dev mailing list