Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: pleus-interpolation-1.16
-
Component/s: plexus-interpolation
-
Labels:None
-
Number of attachments :
Description
ReflectionValueExtractor - which I can find in both org.codehaus.plexus.util.introspection in plexus-utils and also copied in org.codehaus.plexus.interpolation.reflection in plexus-interpolation - misuses WeakHashMap.
/** * Use a WeakHashMap here, so the keys (Class objects) can be garbage collected. * This approach prevents permgen space overflows due to retention of discarded * classloaders. */ private static final Map classMaps = new WeakHashMap();
is nonsense, because the value (ClassMap) strongly refers to the key (Class), so neither will ever be collected. That means that any strongly held ClassLoader which loads ReflectionValueExtractor will also retain any ClassLoader from any Class ever used in evaluate.
http://bugs.sun.com/view_bug.do?bug_id=6389107 makes it impossible to solve this properly, but you can at least make the value be of type SoftReference<ClassMap>.