something like this:

public class ASingletonImpl{
  private static ASingletonImpl instance;
  public synchronized AsingletonImpl getInstance(){
     if (instance==null){
        instance = new ASingletonImpl();
     }
     return instance;
  }

  ///real code here
}

The problem is the cyclic dependence between the Class object, the
ASingletonImpl object and the according ClassLoader. This way nothing
can be freed by the gc.

regards
Leon


On 2/16/07, Jiang, Peiyun <[EMAIL PROTECTED]> wrote:
Just curious, can you elaborate on badly programmed singletons?

Thanks.

Peiyun

-----Original Message-----
From: Leon Rosenberg [mailto:[EMAIL PROTECTED]
Sent: February 16, 2007 11:08 AM
To: Tomcat Users List
Subject: Re: PermGen space


The typical problem here are badly programmed singletons. Do you have any?

regards
Leon

On 2/16/07, Davide Romanini <[EMAIL PROTECTED]> wrote:
> I'm too have this problem, it arises because for some reason the Tomcat
> WebAppClassloader cannot be garbage collected after undeploy. I made a
> lot of tests and didn't find any solution, also very simple and small
> webapps, when loaded/unloaded frequently, caused the problem... :-(
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to