On 14/05/2010 19:21, Mark Shifman wrote: > After playing around I don't think the leak is from JAXBContext. My web app > is running under struts 1.3.10. I tested > the blank web apps that comes with struts 1.3.10 and it showed a memory leak > on undeploying and redeploying. (so did the > blank web app for the current struts 2). Using Eclipse MAT the retained > WebappClassLoader showed a bunch of commons.beanutils > classes but I am not sure how to follow it any farther. > > So either there is something funky with commons.beanutils 1.8.0 (also tried > the newer version)(ie something tricky with reflection or commons-logging) > or I have some how done something really stupid with my tomcat/jvm > configuration that goofs up garbage collection.
Interesting. I had more of a nose around in JAXBContext and the
peripheral objects and found some things I'm slightly curious about but
nothing that looks leaky. I'm using JAXB myself and haven't seen much
of a side-effect.
I'd be happy to have a look at Struts if you'd like to detail some of
what you've found. Maybe we'll find something that can be contributed
to the Tomcat JreMemoryLeakPrevention.
p
> mas
>
> On 05/03/2010 12:15 PM, Mark Shifman wrote:
>> I have a web app running under tomcat-6.0.26 with
>> JreMemoryLeakPreventionListener, java jdk1.6.0_18.
>>
>> Using jmap -histo pid, I can watch
>> com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl, etc increase in number
>> after running my unmarshal action, followed by undeploy and redeploy. Find
>> Leaks in the manager also finds leaks.
>>
>> The JAXBContext instance is created with a singleton that is an enum (using
>> Josh Block's pattern):
>>
>> public enum JAXBContextMascot {
>> INSTANCE("com.matrixscience.xmlns.schema.mascot_search_results_2" );
>> private JAXBContext ctx;
>> JAXBContextMascot(String contextPath) {
>> try {
>> ctx =JAXBContext.newInstance(clazz);
>> } catch (JAXBException e) {
>> throw new RuntimeException(e);
>> }
>> }
>> public Unmarshaller createUnmarshaller(){
>> try {
>> return ctx.createUnmarshaller();
>> } catch (JAXBException e) {
>> throw new RuntimeException(e);
>> }
>> }
>> }
>>
>> Am I doing something wrong which is causing the memory leak?
>> JAXBContext.newInstance() can take a ClassLoader argument. Is there some
>> ClassLoader I should be using that will get around this?
>>
>> Any help would be appreciated.
>> mas
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
signature.asc
Description: OpenPGP digital signature
