PDA

View Full Version : Non-heapspace memory usage


thinkwise
28-04-2010, 16:16
http://java-monitor.com/postedimages/171f0b75-2a9f-4378-8707-f59f0aae2eff.png

Hi there,

A view months ago we had a discussion about client vs server mode of the JVM for my web-applications on my Apache Tomcat server. The memory usage is now much lower and stable. The GCs are also much quicker.

Now I notice that when I deploy a new application the red spikes above occure. I also notice that the non-heap space memory keeps growing especialy then I deploy an application. war-files of my applications are about 65 MB. The result is that I need to restart my web-server after a couple of deployments.

Should the GC also cleanup the non-heap space memory?
Can I clean this memory when I undeploy an application?

Thanks for your time!

kjkoster
28-04-2010, 20:02
Dear thinkwise,

Glad to hear that your Tomcat runs more smoothly after you got some advise here.

These spikes during deployment are normal. Deployments are a fairly big deal for a Tomcat server, since you rip out quite a chunk and replace it with a fresh one. They do not cause your permgen to run out, as you seem to imply in your post. Rather, this is the GC trying to clean out the permgen to make room for the new application.

Permgen leaks are unfortunately fairly normal. It is surprisingly easy to code a webapp in such a way that Tomcat cannot cleanly undeploy it. For this reason I run my test Tomcat servers with fairly large permgens (for example: -XX:MaxPermSize=256M). I never redeploy production servers without restarting Tomcats, so I do not have this problem on production machines.

Note that newer Tomcat versions ship with a permgen leak detector:
Tomcat 6.0.26 has permgen memory leak detection: JreMemoryLeakPreventionListener (http://java-monitor.com/forum/showthread.php?t=818)

Try deploying the application in a new Tomcat and resolve the error messages. :)

Let us know what you find.

Kees Jan