users@glassfish.java.net

Memory Leaks in Glassfish v3

From: <glassfish_at_javadesktop.org>
Date: Wed, 23 Jun 2010 13:41:02 PDT

Glassfish 3.0 has a memory leak caused by a bug in Weld 1.0.0.SP4. In that version, they registered a new singleton CDI Container on every redeployment of an application and forgot to release it.

In jvisualvm heap dumps, I could see multiple copies of these "singletons" hanging around somewhere in the Felix registry, each holding indirect references to WebappClassLoaders, which caused OutOfMemoryErrors after a couple of redeployments.

This bug has been fixed in Weld 1.0.1, so a while ago, I upgraded my application to the unreleased Glassfish version 3.0.1b21 using Weld 1.0.1.SP3, and the problem was gone.

Now when deploying exactly the same version of my application on the released Glassfish version 3.0.1, the memory leaks are back, and even worse than before. After redeploying my application 5 or 6 times and taking a heap dump, I see 8 WebappClassLoader instances, and 5 of them do not have a GC root at all, the other ones are referenced as thread context class loaders.

Any ideas anyone?
[Message sent by forum member 'hwellmann']

http://forums.java.net/jive/thread.jspa?messageID=475587