RFR: 8378319: Obsolete the MaxRAM flag

Albert Mingkun Yang ayang at openjdk.org
Fri Feb 20 13:37:23 UTC 2026


On Fri, 20 Feb 2026 08:46:20 GMT, Joel Sikström <jsikstro at openjdk.org> wrote:

> Hello,
> 
> This PR obsoletes the MaxRAM flag after being deprecated in JDK26. Removing the flag from the arguments-parsing code is straightforward, but is more complicated in the documentation and several tests using the flag.
> 
> For the documentation I've opted to use the term "available memory to the JVM process" consistently instead, which I've repurposed from the now removed description of the MaxRAM flag.
> 
> There are several tests using the MaxRAM flag because of its type (uint64_t). For those tests I've replaced it with either `ErrorLogTimeout` or `StringDeduplicationHashSeed`. Since we don't have any "unlimited/unbound" product uint64_t flags, I've used `StringDeduplicationHashSeed` for places requiring an "unlimited/unbound" flag, and made sure that `-XX:+UnlockDiagnosticVMOptions` is present.
> 
> There are three jtreg tests that have been using MaxRAM to "simulate" being on a machine with more RAM than might be available and I've had to come up with a new approach for all three.
> 
> test/hotspot/jtreg/gc/arguments/TestMaxRAMFlags.java (renamed to TestMaxRAMPercentage.java)
> test/hotspot/jtreg/gc/arguments/TestUseCompressedOopsFlagsWithUlimit.java
> test/hotspot/jtreg/gc/g1/TestRegionAlignment.java
> 
> 
> Perhaps the most controversial change is for TestMaxRAMPercentage.java (renamed from testMaxRAMFlags.java), which is only run for machines with more RAM than the required maxcoopheapsize + a bit of headroom, so we can test all scenarios.
> 
> Testing:
> * I've run all tests that I've changed locally in both release and fastdebug on Mac+Linux.
> * Oracle's tier1-4

src/hotspot/share/runtime/arguments.cpp line 1516:

> 1514: 
> 1515:   // Limit the available memory if client emulation mode is enabled.
> 1516:   const size_t phys_mem = CompilerConfig::should_set_client_emulation_mode_flags()

Based on the comment, I wonder if `avai_mem` is a clearer variable name.

test/hotspot/jtreg/gc/arguments/TestMaxRAMPercentage.java line 59:

> 57: 
> 58:   private static long getHostMaxMemory() {
> 59:       return Long.valueOf(wb.hostPhysicalMemory());

Why using `Long.valueOf`?

test/hotspot/jtreg/gc/arguments/TestMaxRAMPercentage.java line 138:

> 136:       throw new SkippedException("Not enough RAM on machine to run. Test skipped!");
> 137:     }
> 138: 

How is this related to `@requires os.maxMemory`? Can that be used instead?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29838#discussion_r2833202775
PR Review Comment: https://git.openjdk.org/jdk/pull/29838#discussion_r2833212159
PR Review Comment: https://git.openjdk.org/jdk/pull/29838#discussion_r2833227273


More information about the hotspot-dev mailing list