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

Clean up lifecycle of CDS dump-time data structures

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P4
    • 20
    • 20
    • hotspot
    • b10

    Description

      The lifecycle of CDS dump-time data structures such as DumpTimeClassInfo and DumpTimeLambdaProxyClassInfo is not properly managed today, causing memory leak in certain cases.

      We need to implement copy constructors, assignment operators, and destructors in order to work with collections such as ResourceHashtable and GrowableArray.

      ========================

      [1] When cloning the _dumptime_table, etc, we use DumpTimeClassInfo::clone() to make deep copies of the DumpTimeClassInfo objects. However, when the cloned table is freed, the deep copies are not freed properly, leading to memory leak.

      https://github.com/openjdk/jdk/blob/348a0521e1cd602c4093955310f838cf4ce4daae/src/hotspot/share/classfile/systemDictionaryShared.cpp#L1487

      https://github.com/openjdk/jdk/blob/348a0521e1cd602c4093955310f838cf4ce4daae/src/hotspot/share/cds/dumpTimeClassInfo.cpp#L34

      [2] When a DumpTimeClassInfo is freed, the deallocation of its internal fields is done in the wrong place ( SystemDictionaryShared::remove_dumptime_info). This should be done inside the DumpTimeClassInfo destructor instead.

      https://github.com/openjdk/jdk/blob/348a0521e1cd602c4093955310f838cf4ce4daae/src/hotspot/share/classfile/systemDictionaryShared.cpp#L516

      Attachments

        Issue Links

          Activity

            People

              iklam Ioi Lam
              iklam Ioi Lam
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: