RFR: 8238687: Investigate memory uncommit during young collections in G1 [v10]

Thomas Schatzl tschatzl at openjdk.org
Wed Jul 2 07:03:47 UTC 2025


On Tue, 17 Jun 2025 12:52:27 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> Ivan Walulya has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Albert suggestions
>
> src/hotspot/share/gc/g1/g1CollectedHeap.cpp line 894:
> 
>> 892: 
>> 893:   bool should_expand;
>> 894:   size_t resize_bytes = _heap_sizing_policy->full_collection_resize_amount(should_expand, allocation_word_size);
> 
> pre-existing:  I wonder why this isn't a function that returns a `ptrdiff_t` delta on the current size,
> removing the need for multiple values, one being returned via a by-reference out parameter.
> Similarly for the young collection case. Or return the size & direction as a pair-like object.
> (Personally, I find by-reference out parameters confusing to read, but maybe that's just me.)

One potential reason: on 32 bit platforms `ptrdiff_t` is +- 2GB. Heap can be ~4GB on Linux, so `ptrdiff_t` could not represent all potential resize sizes.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25832#discussion_r2179279576


More information about the hotspot-gc-dev mailing list