You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Cox, Charlie" <cc...@cincom.com> on 2002/02/15 16:38:31 UTC
RE: Problems with Manager reload, memory usage and garbage collec
tion.
you're not holding a reference to the class in a session are you? Sessions
aren't released until they timeout.
yes, it is a new classloader each time. that's how reload works since you
cannot unload a class in java without destroying the classloader.
Charlie
> -----Original Message-----
> From: Thomas Ehlen [mailto:thomas@obidobi.net]
> Sent: Friday, February 15, 2002 9:11 AM
> To: Tomcat Users List
> Subject: Problems with Manager reload, memory usage and garbage
> collection.
>
>
> Each time I reload my application with the Manager servlet
> the memory usage
> increase.
>
> Spec: I have Tomcat 4.0.2 and JDK 1.3.1_02 running on a
> Windows2k machine.
>
> I have located my problem using JProbe with Tomcat 4.0.2.
> Looking at the
> instance summary before and after a reload I see that there
> is one class
> that isn't GC'd. So after 10 reloads I have 10 instances of
> this class. The
> class is a singelton and lookes something like this:
>
> public class MySingelton
> {
> private static MySingelton singelton;
>
> private Hashtable resources;
>
> private MySingelton()
> {
> // Create a Hashtable with some resources here
> }
>
> public static Object getResource( String name )
> {
> return resources.get( name );
> }
>
> public static synchronized void configure()
> {
> singelton= new MySingelton();
> }
> }
>
> This Singelton are only called in the init method of my servlet; e.g.
>
> public void init( ServletConfig config )
> throws ServletException
> {
> MySingelton.configure();
> }
>
>
> I guess that Tomcat sets up a new ClassLoader each time an
> application is
> reloaded. So why can't MySingelton be garabage collected?
> Somewhere there
> must still be a reference to it and it isn't in my code for sure.
>
> Please anyone got a suggestion how to solve my problem?
>
> Thanks!
> Thomas Åhlén
>
>
>
> --
> To unsubscribe: <ma...@jakarta.apache.org>
> For additional commands: <ma...@jakarta.apache.org>
> Troubles with the list: <ma...@jakarta.apache.org>
>
--
To unsubscribe: <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>