RFR: 8352765: G1CollectedHeap::expand_and_allocate() may fail to allocate even after heap expansion succeeds [v2]

Thomas Schatzl tschatzl at openjdk.org
Mon Mar 31 08:18:16 UTC 2025


On Thu, 27 Mar 2025 14:33:34 GMT, Ivan Walulya <iwalulya at openjdk.org> wrote:

>> Hi,
>> 
>> Please review this change to ensure that G1 provisions for at least one Eden region after a GC when computing the young length target.
>> 
>> The issue reported in the CR occurs at the end of a GC, after successfully expanding the heap, an allocation fails because `policy()->should_allocate_mutator_region()` returns false. This happens because the computation did not properly account for young regions already allocated as survivor regions, leading to an Eden region target of zero.
>> 
>> With this change, we factor in the young regions that have already been allocated as survivor regions and ensure that at least one region is targeted for Eden.
>> 
>> Testing: Tier 1-3
>>               Reproducer in the CR.
>
> Ivan Walulya has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Thomas Review

Marked as reviewed by tschatzl (Reviewer).

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

PR Review: https://git.openjdk.org/jdk/pull/24257#pullrequestreview-2728523605


More information about the hotspot-gc-dev mailing list