Possible memory leak in com.sun.xml.bind.v2.ClassFactory #563
Description
Hi,
We have a JAX-WS 2.0 based web service endpoint deployed on a Java EE
Application server. This web service endpoint is packaged in a .war file and
deployed. After few deployment and undeployment cycles we see that the
application classloader doesn't get garbage collected.
After profiling the application we figured out that JAXB 2.0's
com.sun.xml.bind.v2.ClassFactory has a threadlocal which keeps a WeakHashMap
with Class object as the key and its Constructor as the value. Since the
Constructor has an implicit reference to Class object, the key(Class object)
would never get GC'ed and hence the Application Classloader.
Since, in an Application server the Web worker threads are pooled, threadlocal
entries would remain throughout the run resulting in a leak.
Environment
Operating System: All
Platform: All
Affected Versions
[2.0.5]