tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
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 <>
> Reply-To: Tomcat Users List <>
> To:
> 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.


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

View raw message