RFR: 8371019: G1: Support heap expansion during startup
Stefan Johansson
sjohanss at openjdk.org
Tue Nov 11 13:03:58 UTC 2025
On Mon, 10 Nov 2025 10:19:00 GMT, Erik Österlund <eosterlund at openjdk.org> wrote:
>> Please review this change to allow G1 to expand the initial heap during startup
>>
>> **Summary**
>> Currently G1 shuts down during startup if we allocate more memory than what's available in the initial young generation. The reason is that we can't allow GCs during initialization. To allow G1 to work in situations requiring additional memory during initialization, this change enables G1 to expand the initial young generation size all the way up the maximum heap size. When initialization is complete mutator allocations will no longer expand the heap.
>>
>> **Testing**
>> * Mach 5 tier1-5
>> * Manual testing requiring additional allocations during startup
>
> I see now how the assert works: it only checks for the VM thread if not owning the heap lock, so I think it won't be an issue. Looks good.
Thanks for the reviews @fisk and @tschatzl
-------------
PR Comment: https://git.openjdk.org/jdk/pull/28213#issuecomment-3516820584
More information about the hotspot-gc-dev
mailing list