Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.0.12
-
Fix Version/s: 2.0.15
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
See http://java.dzone.com/articles/classloaderlocal-how-avoid
I also was under impression that WeakHashMap is good cache.
But it seems that it is not.
See attached screen shot from profiler.
As you can see, CompositeClassLoader is in memory, because TableLayout class is in memory.
Its method is in READ_PROPERTY_RESOLVER_CACHE and uses TableLayout as key (as I understand).
WeakHashMap states:
–
An entry in a <tt>WeakHashMap</tt> will automatically be removed when its key is no longer in ordinary use.
–
But Method is in value of entry, referenced using "strong" reference and Method also has strong reference on its Class.
So, this entry never will be removed.
The caches now encapsulate their values in WeakReferences to avoid the described problem. I will mark as resolved for now, and not close it until you've had a chance to confirm the fix on your end.
Please find the fix in the latest snapshot release and/or the SVN trunk.