Hi Catalin,

the CVS version of dom4j contains a solution for this problem. Could you try it out and let me know if there still are issues with it?

regards,
Maarten

Catalin Grigoroscuta schreef:

Hello,

I've recently debugged an infamous memory leak on a web application, which occurred when the application was started/stopped multiple times.
For some very strange reasons, the class loader that loaded the application refused to be garbage collected.
Investigating this bug I've found quite a lot of bad-written code (including some classes from SUN JDK, and some from jakarta projects).


But the reason I'm posting to this list is because DOM4J was also one of the offending libraries.
The problem is cause by the classes DocumentFactory, QName and DOMDocumentFactory.
They all store an instance in a thread local (to resolve some thread safety problems, I guess).
But when you use DOM4J from a web application, these objects (loaded by the web application class loader) get stuck in container's threads (threads managed by the web container, that usually never stop). The I stop the web application, these objects remain referenced from the container threads, and through them the old app class loader remains referenced, and because of this none of the application classes is garbage collected. And, to make the things worse, the designers of these classes offer no way to clear these ThreadLocalS whatsoever.


This is quite a big architectural bug from my point of view. I've managed to do a workaround for it, but I wonder if there is any "official" solution to this problem.
Or DOM4J in not meant to be used in web applications?


Cheers,
Catalin



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user






-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to