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

Joel Sikström jsikstro at openjdk.org
Tue Oct 14 08:28:02 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.

Joel Sikström has updated the pull request incrementally with one additional commit since the last revision:

  Add comment

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/27765/files
  - new: https://git.openjdk.org/jdk/pull/27765/files/33d4f066..d812f850

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=27765&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27765&range=00-01

  Stats: 3 lines in 1 file changed: 3 ins; 0 del; 0 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