tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luca Passani <>
Subject Re: <c:set> and runtime expressions
Date Wed, 05 Apr 2006 15:32:35 GMT
Kris Schneider wrote:

> The implication that the example singleton class causes a memory leak 
> just because " creates a hard reference to a class instance into 
> the class itself" is hard to believe. There are plenty of other ways 
> to pin classes loaded by the web app's class loader, but the singleton 
> pattern isn't one of them.
> One common way to pin classes is through the JavaBeans Introspector. 
> Since the Introspector caches information about the classes it 
> processes, those references will keep the web app's class loader from 
> becoming eligible for collection. If you're using a container that 
> doesn't take this into account, the common solution is to create a 
> ServletContextListener that calls Introspector.flushCaches in its 
> contextDestroyed method.
> If your singleton is really causing a performance issue, there's 
> probably something else going on. If it's released open source, you 
> might want to post a link to the code so someone can take a look at it.

Great. I would love to be educated about this subject. It gets so tricky 
at times :)
Here is the class that "initializes" the Singleton

this API is meant to be used in command-line, GUI-based and web 
applications alike.
The main reason to introduce the singleton was to avoid that my object 
is garbage collected (re-creating the object implies parsing a 3Megs XML 
file, so garbage collection should be avoided at all costs).



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

View raw message