tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pieter Temmerman <>
Subject Re: Weblogic library and Tomcat
Date Wed, 11 Feb 2009 16:06:16 GMT
Hi Mark,

> You are on the right track with a profiler. I use (and highly recommend)
> YourKit. I get a free copy as an Apache developer for investigating Tomcat
> related issues but it is reasonably priced and I have bought several copies for
> different projects over the years. It usually returns the investment on the
> first issue I fix.

I downloaded YourKit with a 15 day trial license key. That should do for
now. Thanks for the tip!

> As to the why - image a scenario such as this.
> Tomcat starts
> Tomcat (for some reason) loads a JDBC driver
> The JDBC driver is registered with the driver manager
> Note: Tomcat has to load the DriverManager to do this
> Your webapp starts
> Your web app loads a JDBC driver
> Your web app registered the JDBC driver with the driver manager
> Your web app stops
> You have a huge memory leak.
> Why?
> Remembering that every class keeps a reference to the classloader that loaded it:
> DriverManager was loaded by Tomcat
> DriverManager has a reference to your JDBC driver
> Your JDBC driver has a reference to the web application classloader
> The web application class loader retains references to every class it has loaded
Is there any documentation I can read to understand this process better,
or do I rather have to digg into the source code to get a better picture
of all these Tomcat internals?
I'm very interested in understanding how all this works, because at the
end of the day, many problems can be reduced to something easy if you
understand the internals. I'd be glad if you could point me to some good

> Hence none of your classes are unloaded and Tomcat has an instance of your web
> application it can't garbage collect -> memory leak.
Ok. Sounds reasonable. But why aren't my classes unloaded when I
undeploy a webapp? Isn't Tomcat responsible for unloading my classes
when I order it to undeploy my webapp?.

> You need to find which objects are holding on to a reference to the the weblogic
> class and make sure it gets cleared when the app restarts. A context listener
> might be useful here.
I never heard about context listeners, but according to the explanation
at below link, I think I know what you mean. Sounds good!
Just one question. How do you clear an object? Sorry, I'm not a Java
programmer (Actually, I'm not a programmer at all). Would it be
something like object.finalize or object.destroy?

Many thanks Mark.

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

View raw message