如何分析Java核心转储中的信息? [英] How to analyze information from a Java core dump?
问题描述
如果某个进程崩溃并离开核心转储,或者我用 gcore
创建一个进程,那么我该如何分析呢?
If a process crashes and leaves a core dump or I create one with gcore
then how can I analyze it?
我希望能够使用 jmap
, jstack
, jstat
等,还可以查看所有变量的值。
I'd like to be able to use jmap
, jstack
, jstat
etc and also to see values of all variables.
通过这种方式,我可以找到崩溃或冻结的JVM的原因。
This way I can find the reasons for a crashed or frozen JVM.
推荐答案
好的,如果您使用gcore或gdb创建了核心转储,那么您需要将其转换为名为 HPROF 文件的内容。这些可以由VisualVM,Netbeans或Eclipse的Memory Analyzer Tool(以前称为SAP Memory Analyzer)使用。我推荐Eclipse MAT。
Okay if you've created the core dump with gcore or gdb then you'll need to convert it to something called a HPROF file. These can be used by VisualVM, Netbeans or Eclipse's Memory Analyzer Tool (formerly SAP Memory Analyzer). I'd recommend Eclipse MAT.
要转换文件,请使用命令行工具 jmap 。
To convert the file use the commandline tool jmap.
# jmap -dump:format=b,file=dump.hprof /usr/bin/java core.1234
其中:
dump.hprof 是你的hprof文件的名称希望创建
dump.hprof is the name of the hprof file you wish to create
/ usr / bin / java是生成核心转储的java二进制版本的路径
/usr/bin/java is the path to the version of the java binary that generated the core dump
core.1234是您的常规核心文件。
core.1234 is your regular core file.
这篇关于如何分析Java核心转储中的信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!