RFR: 8357445: G1: Time-Based Heap Uncommit During Idle Periods [v7]

Thomas Schatzl tschatzl at openjdk.org
Tue Sep 2 10:19:52 UTC 2025


On Tue, 2 Sep 2025 09:44:25 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

>> src/hotspot/share/gc/g1/g1HeapSizingPolicy.cpp line 550:
>> 
>>> 548:       // 1. No more than 25% of inactive regions
>>> 549:       // 2. No more than 10% of total committed regions
>>> 550:       // 3. No more than max_shrink_bytes worth of regions
>> 
>> This policy sounds like `Min/MaxHeapFreeRatio` that are known to be not useful. Do not have a better idea right now either. Maybe look at what ZGC did at some point.
>
> I also do not think this mechanism should ever uncommit the free regions reserved for the current young gen (without GC/recalculating the needed young gen) and potentially the survivor/old regions. There does not seem to be a limit here.
> 
> Otherwise the next GC (or just continuing work) will be riddled with in-pause commits. Or it will probably do a premature GC, I did not check.
> 
> Maybe this change should only madvise these regions as MADV_DONTNEED? (Not sure it does anything though).

Also there should potentially be a buffer for humongous object allocation, otherwise they will cause immediate garbage collections.
I.e.: err on the conservative side.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26240#discussion_r2315622132


More information about the hotspot-gc-dev mailing list