[ 
https://issues.apache.org/jira/browse/MYFACES-3510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13235769#comment-13235769
 ] 

Leonardo Uribe commented on MYFACES-3510:
-----------------------------------------

I have attached another patch that uses this structure:

    private static Map<ClassLoader, SoftReference<Map<Class<?>, Map<String, 
_PropertyDescriptorHolder>>>>
            propertyDescriptorCacheMap = new WeakHashMap<ClassLoader, 
SoftReference<Map<Class<?>, 
                Map<String, _PropertyDescriptorHolder>>>>();

The idea is use a SoftReference to prevent the direct strong reference over 
propertyDescriptorCache, but use a new key over current classloader to make 
possible when the application is undeployed to clean the cache.

Using yourkit profiler I was not able to see any problem with "metadata" field, 
because a cleanup method is called when the application is destroyed on 
AbstractFacesInitializer.

I also tried to check if the SoftReference solves the problem without the 
cleanup code and it does. I also checked if the solution makes the code slower, 
but the effect is minimal. 
                
> Application components classloader memory leak
> ----------------------------------------------
>
>                 Key: MYFACES-3510
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3510
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions: 2.1.6
>         Environment: WIndows Glassfish Embedded
>            Reporter: Ruben Martin Pozo
>         Attachments: MYFACES-3510-1.patch, MYFACES-3510-2.patch, 
> screenshot-1.jpg
>
>
> We've seen an application classloader memory leak due to the new class 
> javax.faces.component._PropertyDescriptorHolder class introduced in version 
> 2.1.6
> This class holds a reference to a Method of a component loaded by the 
> application classloader. The memory leak shows up when the 
> _PropertyDescriptorHolder is stored in the _ComponentAttributesMap class that 
> is loaded by the system class loader.
> You should use a WeakReference instead of storing the direct reference to the 
> Method

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to