> To summarize the problem:
>
> I had a memory leak when using Tomcats manager to reload my application.
> Analyzing the situation i found that Singeltons are never GC'd. Why?
Looking
> deeper there seems to be a problem with old WebappClassLoaders never
getting
> GC'd and the reason seems to be that there are references to the
> WebappClassLoaders that never get removed.

Yes, that's a good analysis.
I'll apply the patch.

Thanks,
Remy

> See here for more information:
>
> http://nyx.obidobi.net/~thomas/tomcat/index.html
>
> I have located the problem to:
>
> static Hashtables (clBindings, clNameBindings ) located in class
> org.apache.naming.ContextBindings.
>
> The classLoaders are added to these Hashtables by a call from
> lifecycleEvent in the class NamingContextListner.java
>
> =============>
> NamingContextListner.java, 295
>
>             if (container instanceof Context) {
>                 // Setting the context in read only mode
>                 ContextAccessController.setReadOnly(getName());
>                 try {
>                     ContextBindings.bindClassLoader
>                         (container, container,
>                          ((Container)
> container).getLoader().getClassLoader());
>                 } catch (NamingException e) {
>                     log(sm.getString("naming.bindFailed", e));
>                 }
>             }
>
> <============
>
> I think that there should be a call to unbindClassLoader in the following
> code
>
> NamingContextListner.java, 325
>
>         } else if (event.getType() == Lifecycle.STOP_EVENT) {
>
>             if (!initialized)
>                 return;
>
>             // Setting the context in read/write mode
>             ContextAccessController.setWritable(getName(), container);
>
>  New line ===>   ContextBindings.unbindClassLoader( container,
container );
>
>             ContextAccessController.unsetSecurityToken(getName(),
> container);
>
>             namingContext = null;
>             envCtx = null;
>             compCtx = null;
>             initialized = false;
>
>         }
> }
>
> Thomas
>
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>


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

Reply via email to