tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: Memory leak with ThreadGroups
Date Thu, 23 Jan 2003 23:14:53 GMT


On Thu, 23 Jan 2003, Joseph Shraibman wrote:

> Date: Thu, 23 Jan 2003 16:58:28 -0500
> From: Joseph Shraibman <jks@selectacast.net>
> Reply-To: Tomcat Users List <tomcat-user@jakarta.apache.org>
> To: tomcat-user@jakarta.apache.org
> Subject: Memory leak with ThreadGroups
>
> One of my classes creates a static ThreadGroup.  I notice that when I
> update a class and tomcat reloads that context the ThreadGroup is still
> around. If the ThreadGroup is still around that means the old class is
> still around, which means that class loader is still around.  Why is it
> still around?  I tried making the ThreadGroup daemon but it didn't help.
>
> I think the fact that the old class loaders are still around goes a long
> way to explaining why tomcat takes up so much memory.
>

If your application creates new threads (and/or thread groups), then it's
*your* problem to cleam them up when the application shuts down, not
Tomcat's.  Tomcat is only responsible for cleaning up its own threads.

A very easy way to deal with this is create a ServletContextListener and
clean up all your application threads in the contextDestroyed() method.

Craig


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message