Fully featured low overhead profiler for Java EE and Java SE platforms.
Easy to use performance and memory .NET profiler for Windows and Linux.
Performance monitoring and profiling of Jenkins, Bamboo, TeamCity, Gradle, Maven, Ant and JUnit.

Support of HPROF format snapshots

Java has a built-in feature for dumping heap snapshots to files in HPROF binary format. You can analyze these snapshots by using all of the powerful features that YourKit Java Profiler provides for its own memory snapshots.

HPROF snapshots can be created in the following ways:

  • Automatically on OutOfMemoryError

    Read more...

  • Explicitly from within the profiler UI (Oracle JDK/OpenJDK HotSpot)

  • Explicitly via jmap utility (Oracle JDK/OpenJDK HotSpot)

    Java's jmap utility can connect to a running Java process and dump its Java heap:
    jmap -dump:format=b,file=file_name.hprof <PID>

    Hint: to learn the PID (process identifier) of running JVM, you can use jps or jconsole JDK utilities.

    The benefit is that memory can be analyzed on demand with no additional configuration of JVM or Java application. You can dump memory of any running instance of JVM that supports this feature.

  • Explicitly via jconsole utility (Oracle JDK/OpenJDK HotSpot)

    Java utility jconsole allows you to connect to a running Java process for monitoring and management.

    Using jconsole, you can dump Java heap via HotSpotDiagnostic MBean

  • Produced with Java's built-in basic level profiling capability HPROF

    This approach has a lot of drawbacks and is not useful nowadays, but is mentioned here to show the complete picture.

How it works

HPROF snapshots (*.hprof) can be opened the same way as YourKit Java Profiler format snapshots (*.snapshot)

Known issues

Some HPROF snapshots do not contain values of primitive types. When such snapshots are opened in the profiler, values of java.lang.String's will not be available.

Conversion to HPROF

The profiler format .snapshot file can be converted to HPROF binary format to analyze it with a 3rd party tool.

The following command creates a new HPROF file from existing .snapshot:

  • Windows:
    <Profiler Installation Directory>\bin\snapshot2hprof.bat <source>.snapshot <target>.hprof
  • macOS:
    <YourKit Java Profiler.app>/Contents/Resources/bin/profiler.sh <source>.snapshot <target>.hprof
  • Linux and other platforms:
    <Profiler Installation Directory>/bin/profiler.sh -snapshot2hprof <source>.snapshot <target>.hprof

Known issues:

  • Class references to constant pool entries are not exported because they cannot be expressed in HPROF format.
  • HPROF generated from a 64-bit application snapshot will always be detected as having compressed OOPS, i.e. the object reference size will be 4 bytes.

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.