Why is JVM HeapMemoryUsage init value greater than commited / max value?

I have an application with the options below:

-xms2g -xmx2g

I found the init value is greater than max and commited value.
It seems that init value contains the metaspace size. I searched the javadoc, but found no answer for this. Could you give me the code / javadoc reference for this?

Thanks in advance.

VisualVM screenshot

1 Answer

getHeapMemoryUsage describe init as the setting/definition value and not the real sum:

The used and committed size of the returned memory usage is the sum of those values of all heap memory pools whereas the init and max size of the returned memory usage represents the setting of the heap memory which may not be the sum of those of all heap memory pools.

You setting is 2g which is equal to 2147483648 as your init display

Archive from: https://stackoverflow.com/questions/59064137/why-jvm-heapmemoryusage-init-value-is-greater-than-commited-max-value

Leave a Reply

Your email address will not be published. Required fields are marked *