> From: Leon Rosenberg [mailto:[EMAIL PROTECTED] 
> Could you explain it a bit more? What's the difference whether I have
> 10 instances of the same class or just one for reloading?

In a Singleton:

- the class holds a reference to the classloader;

- the class holds a reference to the singleton instance;

- the instance holds a reference to the class.

My understanding is that classes cannot be GCed unless they have no
instances, and classloaders are (obviously) not collected until they
have no references from classes.  So singletons leave classes lying
around in your JVM.  More annoyingly, classes always occupy PermGen
space, so this junk class is now eating up precious space in PermGen -
hence the possibility of an OOME if you reload your webapp too many
times.  The solution is to implement appropriate listeners to make sure
the instance is not referenced by the class before the webapp is
unloaded.

That's a quick recap from memory.  I thoroughly expect Chuck to jump
into the conversation and point out where I've misinterpreted :-).

                - Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to