Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7118277

MappedMXBeanType.convertedTypes abuses WeakHashMap

XMLWordPrintable

      The "Leaking WeakHashMap" canned analysis in the NetBeans Profiler, applied to a heap dump made of the NB IDE, turned up (among other violations):

      MappedMXBeanType.convertedTypes: java.util.WeakHashMap#103 is wrong: key java.lang.Class#10232 is reachable from value sun.management.MappedMXBeanType$CompositeDataMXBeanType#1

      Indeed, MappedMXBeanType.convertedTypes is a WeakHashMap, yet all of the possible value types refer strongly (in fact directly, field 'javaType') to the key type (Class). Since the map is static, if getMappedType is ever called on a class loaded by some user ClassLoader, that loader (including all of its classes and their static fields) will never be collectible.

            sjiang Shanliang Jiang (Inactive)
            jglick Jesse Glick (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: