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:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to