RFR: 8372589: VM crashes on init when NonNMethodCodeHeapSize is set too small and UseTransparentHugePages is enabled

Vladimir Kozlov kvn at openjdk.org
Thu Jan 22 17:08:05 UTC 2026


On Thu, 22 Jan 2026 10:01:17 GMT, Martin Doerr <mdoerr at openjdk.org> wrote:

>> @dbriemann,  this change invalidated assumption that ReservedCodeCacheSize can't change if specified on command line. You replaced `align_down` with `align_up` but did not check that `cache_size` may increase after that.
>> 
>> It also causing issue with AOT because CodeCache size varies between different phases because we use different number of compiler threads and as result different NonNmethod section size.
>
> @vnkozlov: If `ReservedCodeCacheSize` is specified on the command line, but `NonProfiledCodeHeapSize` or `ProfiledCodeHeapSize` is not specified explicitly, we could subtract from one of them. What do you think about that?

@TheRealMDoerr current code at https://github.com/openjdk/jdk/blob/master/src/hotspot/share/code/codeCache.cpp#L228-L262 is doing exactly that.
But new code from these changes at lines L305-L308 invalidates that by aligned up sizes and recalculates new code cache size.  Previous code aligned down sizes but did not recalculate code cache size and, as result, sum of sections sizes could be smaller then it. Which is fine except this bug.
I am not against aligning up but we need to do it before code cache size checks and be smarter how we align it. We can adjust default ReservedCodeCacheSize so that aligning up will not change it.

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

PR Comment: https://git.openjdk.org/jdk/pull/28658#issuecomment-3785549463


More information about the hotspot-compiler-dev mailing list