Mar 18th, 2013, 02:22 AM
Jaxb2Marshaller holding on to objects com.sun.xml.bind.v2.model.impl.RuntimeClassInfo
We're working on a heap dump to identify some production memory problems.
The Memory Analyzer shows
> Class Name | Shallow
> Heap | Retained Heap | Percentage
> org.springframework.oxm.jaxb.Jaxb2Marshaller @ 0x781205ad8|
> 80 | 5,818,424 | 5.96%
and when we expand this there are some 8000+ instances of `com.sun.xml.bind.v2.model.impl.RuntimeClassInfoIm pl` - I've listed 3 below
> Class Name |
> Shallow Heap | Retained Heap | Percentage
> com.sun.xml.bind.v2.model.impl.RuntimeClassInfoImp l @ 0x7815d9008|
> 80 | 111,128 | 0.11%
> com.sun.xml.bind.v2.model.impl.RuntimeClassInfoImp l @ 0x781844198|
> 80 | 31,240 | 0.03%
> com.sun.xml.bind.v2.model.impl.RuntimeClassInfoImp l @ 0x781515760|
> 80 | 28,464 | 0.03%
I'd like to know if there's any Spring setting I need to change to prevent the Jaxb2Marshaller from holding on to these objects? or is this the normal behaviour?
My Spring appContext is
<bean id="jaxbMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshalle r">
<entry key="com.sun.xml.bind.ObjectFactory" value-ref="jaxbObjectFactory" />
<property name="unmarshallerListener" ref="unmarshallerListener"/>
Mar 18th, 2013, 02:46 AM
It's rather not SpringOXM's Jaxb2Marshaller that holds these references - it's probably com.sun.xml.bind.v2.runtime.JAXBContextImpl. Check whether jaxb-impl-2.x.x.jar is in your app or in parent class loader (unless you're not in WAR environment). Do you have memory leaks? Or is it just high memory usage?
Mar 18th, 2013, 03:02 AM
thanks for your quick reply - yes indeed the Marshaller holds com.sun.xml.bind.v2.runtime.JAXBContextImpl which I see holding these 8000+ instances.
We are having memory leaks with very frequent GCs, so this is part of the investigations.
I will check on what you've mentioned.
Mar 18th, 2013, 03:59 AM
I work in the same team as Jose.
To answer your question, the 'jaxb-impl-2.1.9.jar' which has the JAXBContext implementation is part of the application (/WEB-INF/lib) and not in the parent class loader (in our case Tomcat).
Last edited by vinaypammi; Mar 18th, 2013 at 04:03 AM.
Mar 18th, 2013, 04:21 AM
These holding references are usually a problem only if you reload your application often in Tomcat. Of course every memory leak is bad
So do you have problems with low memory (high GC activity)? What "-Xmx" setting do you have in your Tomcat?