I used the Jconsole tool to monitor my
Tomcat server. In the graphs related to memory, I see that both the Heap and Nonheap memories are constantly increasing.
I created a sample
JSP and added some
java code as below
The output of this java code is same as that of the memory statistics shown by Jconsole.
In both the cases, I observed the constant increasing value and when the GC is executed by Tomcat by itself, the memory is freed and again constantly increased.
My web app is not serving any requests other than the Jconsole and my sample JSP.
Now my question is, does the method getHeapMemoryUsage() will show the consolidated memory usage right from the server startup or the amount used by the Heap at the instance the method is called?