Can I analyze .hprof file with Java code?

1k Views Asked by At

I just learned Java Mission Control. I thought about how to make Java Flight Recorder with Java code. I analyzed the heap file with lots of different tools, but this time I want to do it with code.

1

There are 1 best solutions below

1
Klara On

Here are the docs for reading a .jfr file with Java 11 - https://docs.oracle.com/en/java/javase/11/docs/api/jdk.jfr/jdk/jfr/consumer/package-summary.html

There are other (not as supported) APIs for reading older .jfr files (from JDK 8), both with the JFR parser built into the JDK, and the JFR parser built into Java Mission Control.