JVM Heap - Difference Between Max & Allocated Memory in DevTest Portal Server Health


Article ID: 141693


Updated On:


CLOUDTEST CA Application Test CA Cloud Test Mobile MOBILECLOUD Service Virtualization


I have observed that the 2 different scenarios in our configuration. We have given 6 GB (6144 MB) as -Xmx value in vmoptions file.

1.Max is GREATER than Allocated Memory

2. Max is LESS than Allocated Memory

Can you let us know whether Max should be less than Allocated or Greater than allocated Memory?

Where can we make this configuration of Max & Allocated?



Release : 10.4

Component : CA Service Virtualization


Max Memory - Returns the maximum amount of memory that the Java virtual machine will attempt to use. If there is no inherent limit then the value Long.MAX_VALUE will be returned.

Allocated Memory- Returns the total amount of memory in the Java virtual machine. The value returned by this method may vary over time, depending on the host environment. Note that the amount of memory required to hold an object of any given type may be implementation-dependent.

In reference to your question, maxMemory() returns the -Xmx value. It may sometimes lesser than -Xmx value.

For max, its using Runtime.maxMemory()for allocated, its using Runtime.totalMemory()for used, its using Runtime.totalMemory()-Runtime.freeMemory()
Runtime javadocs 


Additional Information