javamemflame will generate a flame graph with Java memory allocation information.
- Java 11
- Apache Maven
mvn clean package
javamemflame will record memory allocation during the lifetime of the JVM with
java -javaagent:/path/to/javamemflame.jar ...
Then the information can be turned into a flame graph using
java -jar /path/to/javamemflame.jar javamemflame-pid.jfr
The result javamemflame-pid.svg
can be viewed with any SVG viewer, like Firefox.
The following agent options are supported.
delay=<number>
: Delays the recording by the specified number of milliseconds.duration=<number>
: Record by the specified number of milliseconds.
Multiple options can be selected using the ',' character, like
java -javaagent:/path/to/javamemflame.jar=duration=1000,delay=500 ...
The output format of javamemflame can be controlled by
java -jar javamemflame.jar -o svg javamemflame-pid.jfr
Supported values
svg
: Flame graphtxt
: Text file
The text file can be turned into a flame graph using FlameGraph
/path/to/FlameGraph/flamegraph.pl --flamechart --color=java javamemflame-pid.txt > javamemflame-pid.svg
javamemflame can use multiple threads to process the .jfr file faster by
java -jar javamemflame.jar -t 8 javamemflame-pid.jfr
javamemflame can filter out allocations under the specified number, and merge them together
under a Filtered
category. F.ex. cut off at 100 MB
java -jar javamemflame.jar -c 100000000 javamemflame-pid.jfr
The flame graph can be given a title using
java -jar javamemflame.jar --title "My FlameGraph" javamemflame-pid.jfr
The number of allocation counts, instead of their combined size, can be done using
java -jar javamemflame.jar -n javamemflame-pid.jfr
Multiple .jfr files can be specified on the command line and their information will be merged
java -jar javamemflame.jar javamemflame-pid1.jfr javamemflame-pid2.jfr
javamemflame can filter on package names, and only include their information
java -jar javamemflame.jar javamemflame-pid.jfr package[,package]*
This project is licensed under EPL v2. See the LICENSE file.