[ 
https://issues.apache.org/jira/browse/GERONIMO-2885?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12512551
 ] 

Alexei Novikov commented on GERONIMO-2885:
------------------------------------------

Please note that calling FactoryFinder.releaseFactories() does not release 
ClassLoaders due to this issue: 
http://issues.apache.org/jira/browse/MYFACES-1558

There are two static hash maps that hold ClassLoaders instances: *_factories* 
and *_registeredFactoryNames*. 
*releaseFactories()* removes ClassLoaders entries only from *_factories* and 
leaves them intact in *_registeredFactoryNames*, which is enough to prevent 
them from being GC'ed.

At the time of this comment being written, this bug was not resolved, but I 
patched FactoryFinder locally with the line of code marked red:

    public static void releaseFactories()
            throws FacesException
    {
        ClassLoader classLoader = getClassLoader();
        _factories.remove(classLoader);
       {color:red}  _registeredFactoryNames.remove(classLoader);{color} 
    }

... and observed that the memory leak disappears.

> JSF is leaking application ClassLoaders
> ---------------------------------------
>
>                 Key: GERONIMO-2885
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-2885
>             Project: Geronimo
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>          Components: Jetty, Tomcat
>    Affects Versions: 2.0-M3, 2.0-M5
>            Reporter: Kevan Miller
>             Fix For: 2.0-M5
>
>
> javax.faces.FactoryFinder is holding onto application ClassLoaders. This 
> prevents the ClassLoaders from being GC'ed after an undeploy.
> Need to call FactoryFinder.releaseFactories() during undeploy. This will 
> release the current ContextClassLoader.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to