javaopenjdk-11jfr

JFR: OutOfMemoryError while reading .jfr file


I'm trying to analyze a large Flight Recorder file (1.5 GB) that I created previously. When executing the jfr print command, the tool runs into an OutOfMemoryError:

$ jfr print --events "jdk.CPULoad" <file>

jfr print: unexpected internal error, Java heap space
java.lang.OutOfMemoryError: Java heap space
    at jdk.jfr/jdk.jfr.consumer.ParserFactory$CompositeParser.parse(ParserFactory.java:283)
    at jdk.jfr/jdk.jfr.consumer.ParserFactory$ArrayParser.parse(ParserFactory.java:268)
    at jdk.jfr/jdk.jfr.consumer.ParserFactory$CompositeParser.parse(ParserFactory.java:285)
    at jdk.jfr/jdk.jfr.consumer.ChunkParser.fillConstantPools(ChunkParser.java:141)
    at jdk.jfr/jdk.jfr.consumer.ChunkParser.<init>(ChunkParser.java:71)
    at jdk.jfr/jdk.jfr.consumer.ChunkParser.<init>(ChunkParser.java:56)
    at jdk.jfr/jdk.jfr.consumer.RecordingFile.findNext(RecordingFile.java:253)
    at jdk.jfr/jdk.jfr.consumer.RecordingFile.<init>(RecordingFile.java:108)
    at jdk.jfr/jdk.jfr.internal.tool.EventPrintWriter.print(EventPrintWriter.java:71)
    at jdk.jfr/jdk.jfr.internal.tool.Print.execute(Print.java:165)
    at jdk.jfr/jdk.jfr.internal.tool.Main.main(Main.java:84)

Is there a way to increase the heap size (-Xmx) for the jfr tool itself? I haven't found a corresponding option in the documentation. Any help is appreciated :)


Solution

  • As suggested by Kris, there is an environment variable that can be used: JAVA_TOOL_OPTIONS

    In my case, the following did the trick:

    export JAVA_TOOL_OPTIONS="-Xmx5G"