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

book

Article ID: 141693

calendar_today

Updated On:

Products

CLOUDTEST CA Application Test CA Cloud Test Mobile MOBILECLOUD Service Virtualization

Issue/Introduction

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?

 

Environment

Release : 10.4

Component : CA Service Virtualization

Resolution



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

https://docs.oracle.com/javase/8/docs/api/java/lang/Runtime.html

Attachments