You can set the maximum heap size as a percentage of total memory with:
-XX:MaxRAMPercentage=x, where x is the desired percentage of heap memory between 0 and 100 of type double.
Will set the max heap size to 15.2654 and 30%:
This Oracle HotSpot option can be used to specify the maximum size of the Java heap as a percentage of the total memory available to the JVM. If you set a value for -Xmx, the -XX:MaxRAMPercentage option is ignored. If your application is running in a container and you have specified -XX:+UseContainerSupport, the default heap size for containers, the -XX:MaxRAMPercentage option is based on the available container memory.
Accepts only numeric double values from 0 to 100
TODO link Xmx, Xms, UseContainerSupport, InitialRAMPercentage
If you have additional comments, interesting experiences or even point of disagreement with this JVM argument description, please leave a comment. Your insights will help the entire 10+ million java developer community to develop one standard source of documentation for all the JVM arguments.
Edit your Comment