JVM free memory does not match -Xmx value

Document ID : KB000101560
Last Modified Date : 14/06/2018
Show Technical Document Details
Question:
A Java application can  be started with options that specify the memory allocation to be given to the JVM. When examining the allocated heap size reported by the JVM this is smaller than the allocation given.
Environment:
Any non-trivial Java application 
Answer:
The memory allocation is shared between the heap and other memory structures - the most significant is the "survivor" area. Within the JVM are two areas tagged for the storage of short term objects that are not eligible for garbage collection (GC) - these areas are survivor areas S0 and S1. On any given  GC cycle, object hat must survive are copied from one survivor area to the other and the newly emptied are freed. There is thus always one of S0 or S1 allocated at any time, and this is subtracted from the total allocation

 
Additional Information:
Java memory management is described here https://www.journaldev.com/2856/java-jvm-memory-model-memory-management-in-java