I’m using Tomcat 6.0.18. After undeployemnt of my app, HttpClient appears to be holding a reference to WebappClassLoader, hence causing the memory leak.
After some investigation, I’ve found solution in Tomcat 7.0.6, JreMemoryLeakPreventionListener with keepAliveProtection attribute. But this approach is not working with Tomcats 6 (I’ve customized JreMemoryLeakPreventionListener, in order to add support for this attribute).
Does anybody have a solution how to fix this leak in Tomcat 6?
Thanx!
I’ve found the solution for memory leak.
One must make implementation of ServletContextListener, as following:
and, of course, to register listener in web.xml: