Affects Version/s: 1.3.1
Fix Version/s: 1.4
JDK version and platform:Sun 1.6.0_17
Sun14ReflectionProvider has a constructor cache.
However, these caches are gone for every minor GC, because WeakReference of constructor hasn't been referred by anyone when the constructor finish instantiating the object. So, whenever getMungedConstructor is called, constructor is newly created.
The objects in PermGen space isn't collected when minor GC, so it causes frequent full GC.
Jörg Schaible added a comment -
Dropped WeakHashMap altogether in HEAD. It did not made sense as you have pointed out.
Jörg Schaible added a comment - Dropped WeakHashMap altogether in HEAD. It did not made sense as you have pointed out.
Thanks for heads-up and this is not the only place for such a strategy in XStream. The problem is, if we don't use the WeakReference for the Constructor instances, we create a memory leak for static XStream instances, because a Constructor instance refers its Class that is used as key. I am thinking for some time now for the best strategy to cache lookups for Constructor and Method instances that do not create a memory leak when their original classloader is dropped. Ideas?