[ 
https://issues.apache.org/jira/browse/LANG-436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12604782#action_12604782
 ] 

Erik Voorbraak commented on LANG-436:
-------------------------------------

So you removed caching for org.apache.commons.lang.reflect.MethodUtils.java. 
Should the same not also happen for 
org.apache.commons.beanutils/MethodUtils.java? This is where I discovered a 
memory leak today.

As far as I can see, it uses a WeakHashMap, whose keys are weak references. 
However, the map is filled with MethodDescriptor instances, which are created 
in the same method as where they are put as keys in the map. So one would 
expect that the get garbage collected on the first occasion. It looks like the 
cache should have been one where the values are weak. Why we still had the 
memory leak, I cannot explain.

> Remove caching from MethodUtils
> -------------------------------
>
>                 Key: LANG-436
>                 URL: https://issues.apache.org/jira/browse/LANG-436
>             Project: Commons Lang
>          Issue Type: Bug
>            Reporter: Niall Pemberton
>            Assignee: Niall Pemberton
>             Fix For: 3.0
>
>         Attachments: LANG-436-remove-MethodUtils-caching.patch
>
>
> I think we should remove the caching from MethodUtils. This has caused memory 
> leak problems in BeanUtils (where it was copied from) and better IMO to just 
> provide the pure reflection API in lang and let downstream users provide 
> solutions for improving performance.

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