tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arto Huusko <>
Subject DispatchData in ApplicationContext causes ClassLoader leak
Date Tue, 04 Mar 2008 10:32:44 GMT
The DispatchData subclass in org.apache.cataline.core.ApplicationContext
causes ClassLoader leak, when a web application is undeployed.

When a URI belonging to the web application is accessed, a reference to
the ApplicationContext object is made through the DispatchData instance,
and the DispatchData instance is stored in a ThreadLocal variable.
Because DispatchData is not static inner class, it causes a reference
to the ApplicationContext object (which through a few steps causes
reference to the ClassLoader).

The path to ApplicationContext is (from jhat output) for example:

--> java.lang.ThreadGroup@0x2aa4b85608 (67 bytes)  (field threads:)
--> [Ljava.lang.Thread;@0x2aa674dda0 (272 bytes) (Element 21 of
--> java.lang.Thread@0x2aa6f4b418 (164 bytes) (field threadLocals:)
--> java.lang.ThreadLocal$ThreadLocalMap@0x2aa6f86d18 (32 bytes) (field table:)
--> [Ljava.lang.ThreadLocal$ThreadLocalMap$Entry;@0x2aa6f86d38 (528 bytes)
(Element 16 of [Ljava.lang.ThreadLocal$ThreadLocalMap$Entry;@0x2aa6f86d38:)
--> java.lang.ThreadLocal$ThreadLocalMap$Entry@0x2aa6f87408 (56 bytes)
(field value:)
--> org.apache.catalina.core.ApplicationContext$DispatchData@0x2aa6f87440
(40 bytes) (field this$0:)
--> org.apache.catalina.core.ApplicationContext@0x2aa6f87b88 (72 bytes)

Please consider making DispatchData a static inner class, so that
reference to ApplicationContext will not hang around.

I'm also puzzled why dispatchData field in ApplicationContext is not

Arto Huusko

Ruukinkatu 2-4, 20540 Turku, Finland

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message