Fully featured low overhead profiler for Java EE and Java SE platforms.
Easy-to-use performance and memory .NET profiler for Windows, Linux and macOS.
Secure and easy profiling in cloud, containers and clustered environments.
Performance monitoring and profiling of Jenkins, Bamboo, TeamCity, Gradle, Maven, Ant and JUnit.

Support of Portable Heap Dumps (.phd)

Eclipse OpenJ9 JVM, previously known as IBM J9 or simply IBM Java, has a built-in feature for dumping Java heap to a file in the Portable Heap Dump (PHD) binary format. The associated file name extension is .phd.

You can analyze these dumps by using the powerful features that YourKit Java Profiler provides for its own memory snapshots. However, due to the PHD format limitations, not all features are available.

Format limitations

A Java heap dump in the PHD format has a number of limitations comparing with the profiler format snapshot (.snapshot) and a HotSpot JVM's HPROF dump (.hprof).

  • Only live objects are reported.

    Reachability scopes are therefore restricted.

  • GC roots are not specified.

    It is not explicitly known which objects are roots and of what kind. The profiler has to infer the root objects by using the following rules:

    • A class (i.e. instance of java.lang.Class) loaded by the system loader becomes a roots of type "Class".
    • An object having no incoming references from other objects (i.e. self-references don't count) becomes a root of type "Held by JVM".

  • No primitive type values are available in fields and arrays.

    Primitive arrays like int[] or char[] themselves exist but their elements are unknown.

    Object primitive fields are not presented at all.

    java.lang.String values are also unavailable because they depend on the underlying field of type char[] or byte[].

  • Class metadata does not include field names.

    All instance field and static references are anonymous.

  • Null references are not reported for object fields and arrays.

    As the result:

    • For an array with null elements, all reported elements are moved towards the start of the array, so the indices may differ from the original ones. However, the element order is preserved.
    • For an object with null instance fields, the shown reference index for the same original field may differ for different objects of the same class. The same reference number in several instances of a class does not necessarily mean the reference belongs to the same original field.

Therefore, to analyse full information about the Java heap it's recommended to use a YourKit Java Profiler snapshot instead of a PHD whenever possible. Using a PHD dump makes sense when it is not possible or not feasible to capture a YourKit Java Profiler snapshot instead, e.g. when analyzing a dump automatically captured on a production machine.

Dump creation

The heap dump dump can be generated in either of two ways:

  • Explicit generation
  • JVM triggered generation

Explicit generation

The Java heap dump can be explicitly generated in the following ways:

  • By using the IBM/OpenJ9 Java's jcmd command line utility:

    jcmd <PID> Dump.heap

    Creates file heapdump.<date>.<time>.<PID>.<running number>.phd in the location described in Location of the heap dump.

    jcmd <PID> Dump.heap <path>.phd

    Creates file with given path.

    Important: ensure that the target file does not exist at the moment of issuing the command. Otherwise, the dump command rejects to overwrite an existing file and fails with an error, e.g:

    Error: openj9.management.internal.InvalidDumpOptionExceptionBase
    Error in dump options.

  • By sending a signal to the JVM from the operating system.

    For Linux and AIX, send the JVM the signal SIGQUIT (kill -3, or CTRL+\ in the console window).

    For Windows, generate a SIGINT (Ctrl+Break).

    To enable signal-based Java Heap dumps, the IBM_HEAPDUMP=TRUE environmental variable or the appropriate JAVA_DUMP_OPTS must be set.

  • By using the HeapDump() method inside Java code that is being executed.

Please refer to IBM Java/OpenJ9 documentation for more information.

JVM triggered generation

The following events automatically trigger the JVM to produce a Java Heap dump:

  • A fatal native exception occurs in the JVM (not a Java Exception).
  • An OutOfMemoryError or heap exhaustion condition occurs (optional).

If Java Heap dumps are enabled, they are normally produced immediately before a thread dump. They are produced also if the JVM terminates unexpectedly (a crash).

Please refer to IBM Java/OpenJ9 documentation for more information.

Location of the heap dump

The JVM checks each of the following locations for existence and write-permission, then stores the Heap dump in the first one that is available.

  • The location that is specified by the IBM_HEAPDUMPDIR environment variable, if set.
  • The current working directory of the JVM process.
  • The location that is specified by the TMPDIR environment variable, if set.
  • The temporary directory.

YourKit uses cookies and other tracking technologies to improve your browsing experience on our website, to show you personalized content and targeted ads, to analyze our website traffic, and to understand where our visitors are coming from.

By browsing our website, you consent to our use of cookies and other tracking technologies in accordance with the Privacy Policy.