When you add
-Xmx????m
to the command line, the JVM gives you a heap which is close to this value but can be out by up to 14%. The JVM c
The following graph shows the Runtime.maxMemory as a percentage of Xmx (on the y-axis) for different Xmx values (on the x-axis).
We see that for the most part only ~85% of the Xmx setting is available for the heap to grow. This analysis is conducted using java version "1.8.0_212" Java(TM) SE Runtime Environment (build 1.8.0_212-b10) Java HotSpot(TM) 64-Bit Server VM (build 25.212-b10, mixed mode)
Graph of (maxMem/Xmx) for varying Xmx sizes (in MB)