Integrated: 8369658: Client emulation mode sets MaxRAM too late
Joel Sikström
jsikstro at openjdk.org
Thu Oct 23 08:25:18 UTC 2025
On Mon, 13 Oct 2025 11:25:04 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.
This pull request has now been integrated.
Changeset: dcf46a0a
Author: Joel Sikström <jsikstro at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/dcf46a0a195d7386ed0bc872f60eb9c586425cc8
Stats: 32 lines in 3 files changed: 23 ins; 5 del; 4 mod
8369658: Client emulation mode sets MaxRAM too late
Reviewed-by: aboldtch, stefank
-------------
PR: https://git.openjdk.org/jdk/pull/27765
More information about the hotspot-gc-dev
mailing list