且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用jmap命令的Java堆转储错误:过早的EOF

更新时间:2023-01-11 18:36:54

Brian的评论有助于解决问题。

Brian's comment is helpful to resolve the issue.

如果您正在使用 G1GC 64位机器中的算法:

If you are using G1GC algorithm in 64 bit machine:

下面的命令不起作用(不包括实时选项)

jmap -J-d64 -dump:format=b,file=<heap_dump_filename> <pid>

你必须使用以下选项才能获得堆转储

jmap -J-d64 -dump:live,format=b,file=<heap_dump_filename> <PID>

有一些建议可以使用 -F 强制堆转储的选项但是按照oracle technotes

There are some suggestions to use -F option to force heap dump but as per oracle technotes:


-F
强制。如果pid没有响应,请使用jmap -dump或jmap -histo选项。此模式不支持实时子选项。

-F Force. Use with jmap -dump or jmap -histo option if the pid does not respond. The live suboption is not supported in this mode.

由于G1GC选项需要堆转储,因此无法使用上述选项。

Since heap dump is required with G1GC option, above option can't be used.