RFR: 8378319: Obsolete the MaxRAM flag [v2]

Joel Sikström jsikstro at openjdk.org
Fri Feb 20 15:52:03 UTC 2026


On Fri, 20 Feb 2026 13:28:10 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

>> Joel Sikström has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains four commits:
>> 
>>  - Merge branch 'master' into JDK-8378319_obsolete_maxram
>>  - Rename phys_mem to avail_mem
>>  - Simplify TestMaxRAMPercentage.java
>>  - 8378319: Obsolete the MaxRAM flag
>
> 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.

I renamed it to `avail_mem`, hope that's OK!

> 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`?

No we don't need this. I'll just inline the function to the caller without 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?

If we do the "dynamic" check inside the test like I have it right now, we check the maxcoopheap size (which depends on page size of the system), and also HeapBaseMinAddr, which is platform dependent. We could use a guaranteed value for a "static" check with `@requires os.maxMemory`, like 32GB which is always enough, but then we could miss out on running the test in some scenarios. Maybe that's fine.

Sidenote: When checking out the value of HeapBaseMinAddr I see that all platform dependent code set the same value. It could be worth investigating if that should be moved from platform dependent files to a common one.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29838#discussion_r2833856226
PR Review Comment: https://git.openjdk.org/jdk/pull/29838#discussion_r2833836950
PR Review Comment: https://git.openjdk.org/jdk/pull/29838#discussion_r2833836849


More information about the hotspot-dev mailing list