Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I determine the JVM minimum heap size from within a java application?

I have reviewed the answer to how to get the min and max heap size settings of a JVM from within a Java program which was helpful, but the accepted answer doesn't appear to answer half of the question. In essence, I want to report the -Xms and -Xmx settings that were used when the JVM was launched.

like image 574
pamphlet Avatar asked Sep 26 '11 18:09

pamphlet


1 Answers

These are the mappings between values you're looking for:

-Xmx=Runtime.getRuntime().maxMemory()
-Xms=Runtime.getRuntime().totalMemory()

Hope this helps.

like image 88
Mike K. Avatar answered Sep 20 '22 22:09

Mike K.