OutOfMemory PermGen with Sun JDK reviewed again

In: Java

11 Oct 2007

The response to my post about OutOfMemory PermGen errors in Tomcat with Sun JDK brought up some very interesting things. I learned a lot from Frank Kieviet’s blog about possible classloader memory leaks and jhat usage. One comment brought up that it could be a Tomcat bug and it should be fixed with version 6 so I ran the same test again with Tomcat 6.0.14:

Permgen Tomcat 6

As you can see when restarting the lambdaprobe application and accessing it again and again results in increasing the PermGen memory usage until it the OutOfMemory error occurs. This is the same behavior as with Tomcat 5 – so it seems the problem is not cause by the container.

To be sure that the memory leak is caused by the application I ran the same test with a very small application included in Tomcat: the JSP-examples. Though this application does not contain many classes the memory consumption for loading them is not very much but it should be enough when reloading it a thousand times. Here are the results for Tomcat 5:

Examples Tomcat 5 Java 6

and for Tomcat 6, both running on Sun JDK 6:

Examples Tomcat 6 Java 6

After running these tests it was clear to that the memory leak is caused by the application. It is no bug in Tomcat or Sun JDK. I will have to take a closer look on our web applications to find out what reference causes this problem. Using a current or patched versions of jhat should allow me to find the problem.

4 Responses to OutOfMemory PermGen with Sun JDK reviewed again

Avatar

stoney

October 11th, 2007 at 6:38 pm

I will have to take a closer look on our web applications to find out what reference causes this problem

I thought it wasn’t “your” application that caused the problems … ;-)

Avatar

tompson

October 11th, 2007 at 9:52 pm

What I tried to say in the comment was that I made the tests with lambdaprobe – which is not “my” application.

Though “my” application has the same problem ;-)

Avatar

Jo Vandermeeren

January 14th, 2008 at 5:34 pm

Are you using CGLIB to create proxies?
This also blows up the perm gen space.

Avatar

tompson

January 14th, 2008 at 11:04 pm

@Jo: no, I do not us CGLIB in this project … but thanks for the tip

Comment Form

Follow Me!

Photostream

    Weihnachten 2009Saalfelden Weihnachten 2009Dodothree brothersThe Bolds 004troii Weihnachtsfeier 2009 006

RSStOMPSON's tweets