I'm looking at my tomcat using jconsole and I'm trying to understand why the heap size varies between 0.4GB and 1GB.

I thought I told it to start at ~1GB and use no more than ~6GB.

Can anyone explain what is going on.

My commandline has these memory and GC options: java -XX:NewSize=700m -XX:MaxNewSize=700m -Xms1202m -Xmx6014m -XX:MaxPermSize=256m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=20 -XX:ParallelGCThreads=4

jconsole memory view

-Xmsn Specify the initial size, in bytes, of the memory allocation pool

You've told it to start at 1GB.

-Xmxn Specify the maximum size, in bytes, of the memory allocation pool.

You've told it to use at most 6GB.

I don't see any contradiction between what you see, and the behaviour your screenshot describes. -XX:MaxNewSize will force the JVM to start with 700Mo. However, I don't find much doc about this option around the interwebs, so I can't be sure.

Then, your application runs, objects are allocated, and sometimes, the garbage collector fo its work, freeing memory. You just don't reach the limit value you specified at the beginning (certainly because your application does not need it currently). The minimum memory you need is about 370Mo.

Thre is not any problem nor with your configuration (except maybe this -XX:NewMemorySize that I can't understand) neither with the behaviour of your application.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.