RFR: 8369658: Client emulation mode sets MaxRAM too late [v2]

Stefan Karlsson stefank at openjdk.org
Thu Oct 23 08:18:08 UTC 2025


On Tue, 14 Oct 2025 08:28:02 GMT, Joel Sikström <jsikstro at openjdk.org> wrote:

>> Hello,
>> 
>> While working on the proposal for the potential deprecation of MaxRAM (see [JDK-8369347](https://bugs.openjdk.org/browse/JDK-8369347)) I saw that `CompilerConfig::ergo_initialize()` sets the value for `MaxRAM` after ergonomic heap sizing is already done, which is the only place in the VM that cares about `MaxRAM`. I suggest we move setting the value of `MaxRAM` to `Arguments::set_heap_size()` to fix this.
>> 
>> Even though the `MaxRAM` flag might be deprecated, the code should still account for the fact that client emulation mode might lower the maximum amount of physical memory that can be used for the Java heap. If the flag is removed, we'd still want to lower the maximum memory, so it makes sense to have the code in `Arguments::set_heap_size()` in both cases.
>> 
>> Testing:
>> * Oracle's tier1-2
>> * Local test with `java -XX:+NeverActAsServerClassMachine -Xlog:gc+init` to see that the lower limit is reflected in ergonomic heap sizing.
>
> Joel Sikström has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Add comment

Looks good. But the next step needs to be deprecate the client emulation mode.

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

Marked as reviewed by stefank (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/27765#pullrequestreview-3368743381


More information about the hotspot-gc-dev mailing list