XStream
  1. XStream
  2. XSTR-646

PermGen is consumed by Sun14ReflectionProvider more than necessary

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.3.1
    • Fix Version/s: 1.4
    • Component/s: Converters
    • Labels:
      None
    • JDK version and platform:
      Sun 1.6.0_17

      Description

      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.

        Activity

        Hide
        Jörg Schaible added a comment -

        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?

        Show
        Jörg Schaible added a comment - 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?
        Hide
        Jörg Schaible added a comment -

        Dropped WeakHashMap altogether in HEAD. It did not made sense as you have pointed out.

        Show
        Jörg Schaible added a comment - Dropped WeakHashMap altogether in HEAD. It did not made sense as you have pointed out.

          People

          • Assignee:
            Jörg Schaible
            Reporter:
            Yoshitaka Kawashima
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: