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

Create heap dump file for CDS archive

XMLWordPrintable

      An AOT cache created with JEP 483 (JDK-8315737) contains a set of cached java heap objects.

      During the development of Project Leyden, we expect more and more types of Java heap objects to be included in the AOT cache. For debugging purposes, we should create a heap dump file (.hprof) that describes all of the archived objects. The .hprof file can be then analyzed with many Java development tools (e.g., https://docs.oracle.com/javase/8/docs/technotes/guides/visualvm/heapdump.html )

      The hprof file can be created with a diagnostic JVM flag. Something like:

      java -XX:AOTMode=create \
             -XX:AOTConfiguration=in.aotconfig \
             -XX:AOTCache=out.aot \
             -XX:+UnlockDiagnosticVMOptions -XX:AOTHeapDump=debug.hprof

      Today, you can use "jcmd <pid> GC.heap_dump /path/to/dump.hprof" to dump all live Java objects in a running JVM process. To implement this RFE, we should be able to reuse the existing code (e.g., HeapObjectDumper: https://github.com/openjdk/jdk/blob/7c9a7840ea75a9a7df3f240d063e9833f535e6ec/src/hotspot/share/services/heapDumper.cpp#L1979C7-L1979C7 ) for writing heap objects.

      Instead of writing all live objects from the Java heap, we should restrict the set of objects to those that have been copied into the AOT cache during the AOT cache "assembly phase". These are the objects recorded in the ArchiveHeapWriter::_source_objs array. This array should be fully populated when ArchiveHeapWriter::write() is called, so we can dump the hprof file inside this function. (See https://github.com/openjdk/jdk/blob/7c9a7840ea75a9a7df3f240d063e9833f535e6ec/src/hotspot/share/cds/archiveHeapWriter.cpp#L100 )

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

              Created:
              Updated: