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

[lworld] LW3 Reduce impact of IdentityObject on metaspace



    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: repo-valhalla
    • Fix Version/s: repo-valhalla
    • Component/s: hotspot
    • Labels:


      The IdentityObject interface put an unexpected stress on metaspaces.

      Each InstanceKlass instance uses two arrays to store interfaces information: one for locally implemented interfaces, one for the transitive set of implemented interfaces. Before the introduction the IdentityObject interface, many classes and interfaces had no local interface and often no interfaces in their transitive set, making them to use empty arrays for these fields. Because the use of an empty array was so common, the JVM optimizes it by using a single universally accessible empty array instead of having each InstanceKlass instance to allocate its own empty arrays.

      The situation changed with the introduction of the IdentityObject interface, with many classes and interfaces now having this single interface in their local and transitive interface set. Early measurements performed on tier1 tests shown that roughly half the classes and interfaces that were using the empty array are now creating their own copy of a single element array containing the IdentityObject interfaces. This leads to the creation to dozens up to several hundreds copies of this particular array (~1/3 of loaded classes create such an array).

      The pressure on metaspaces can be reduced by using the same solution as for the empty array: creating a universally available single element array containing the IdentityObject interfaces. However, the creation of this array is more complex than the creation of the empty array because it cannot be populated correctly until the IdentityObject's InstanceKlass instance has been created.


          Issue Links



              fparain Frederic Parain
              fparain Frederic Parain
              0 Vote for this issue
              2 Start watching this issue