tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diego Rodríguez Martín <>
Subject Cleanup of org.apache.naming.resources.CacheEntry resources
Date Fri, 08 Feb 2008 18:29:36 GMT

    I am memory profiling a webapp for my company because we suspect it 
has memory leaks when redeploying. This webapp has to be redeployed 
several times a week for security reasons (most of the time it is 
undeployed) and the memory leaks forced us to shutdown tomcat once a 
week to avoid OOM exception.

    I'm using jvm1.5 and tomcat 6.0.13 (also tried with 6.0.14 and today 
with 6.0.16), and Yourkit as the profiling tool. I have made the test in 
both linux and windows.

    I have created a JMeter test to deploy the app using the manager, 
make some request to the app and then undeploy it using again the 
manager app in a loop. After some redeployments, I got my 
OutOfMemoryException. Then I checked with my profiling tool and found 
that my own classes were correctly destroyed, and the classes retaining 
more memory were these ones (listed as a heirarchy):

mapper of  org.apache.catalina.core.StandardContext
context of  org.apache.tomcat.util.http.mapper.Mapper
resources of  org.apache.tomcat.util.http.mapper.Mapper$Context  
cache of  org.apache.naming.resources.ProxyDirContext  
cache of  org.apache.naming.resources.ResourceCache

    The number of objects of each class were exactly the number of times 
I had redeployed the webapp. I have checked the contents of CacheEntry 
inside CacheEntry[] and it has an attribute "name" and the contents are 
the jsps and tld files of my app. There are as many CacheEntry with the 
same jsp attribute as times the webapp has been reloaded.

    I have made a simple webapp with 2 jsp and a taglibrary, and the 
memory leak is still there, so I guess there is no cleaning of 
CacheEntry resources at context shutdown.

    Have I found a memory leak in Tomcat?
    Is my explanation correct or I have missed the leak source?
    Should I open a BZ issue?

    Is there any workaround to clean this resources on context shutdown?

Diego Rodríguez Martín
ALTIRIA TIC - Servicios SMS - Desarrollo Web
Tel. +34 913311198 - Fax +34 915713993 - Móvil +34 610299750

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message