RFR: 8369658: Client emulation mode set MaxRAM too late
Joel Sikström
jsikstro at openjdk.org
Mon Oct 13 11:36:18 UTC 2025
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:
* Currently running 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.
-------------
Commit messages:
- 8369658: Client emulation mode set MaxRAM too late
Changes: https://git.openjdk.org/jdk/pull/27765/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27765&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8369658
Stats: 29 lines in 3 files changed: 20 ins; 5 del; 4 mod
Patch: https://git.openjdk.org/jdk/pull/27765.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/27765/head:pull/27765
PR: https://git.openjdk.org/jdk/pull/27765
More information about the hotspot-gc-dev
mailing list