Pieter Temmerman wrote:
> 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
> docs.

The YourKit help is quite good as I recall.

>> 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?.

Tomcat will clear the references it has created but you are responsible for
clearing the references you create. Once all the references are cleared gc will
remove it.

In this case your classes are pinned into memory by the following reference 
chain:

DriverManager > JDBC driver > webapp classloader > webapp classes

Since you created this by calling DriverManager.registerDriver() you have to
clear it.

>> 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?

It depends on how the reference is maintained. In the DriverManager example you
would use DriverManager.deregisterDriver() to break the reference chain.

What you need to use in your case will depend on exactly what is in the
reference chain and where it needs to be broken.

Mark



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to