-Xmx
flag is used to: set the the maximum heap size
while the
-XX:MaxRAMPercentage
is used to: specify the maximum size of the Java heap as a percentage of the total memory available to the VM
Is it better to use -Xmx
or -XX:MaxRAMPercentage
? When should each be used?