JVM free memory does not match -Xmx value


Article ID: 101560


Updated On:


CA Application Test Service Virtualization CA Continuous Application Insight (PathFinder) CA Service Virtualization (DevTest / LISA / VSE / Application Test)


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.


Any non-trivial Java application 


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 that 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