我正在尝试将Linux Java进程的核心转储文件转换为堆转储文件,以便使用Eclipse MAT进行分析。根据this博客文章(已适配新版OpenJDK 12),我创建了一个核心转储文件,然后运行
核心转储文件为22 Gb,而堆转储文件仅为3 Mb,因此很可能
jhsdb jmap
将其转换为HPROF格式:>sudo gcore -o dump 24934
[New LWP 24971]
...
[New LWP 17921]
warning: Could not load shared library symbols for /tmp/jffi4106753050390578111.so.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007f94c7e9e98d in pthread_join (threadid=140276994615040, thread_return=0x7ffc716d47a8) at pthread_join.c:90
90 pthread_join.c: No such file or directory.
warning: target file /proc/24934/cmdline contained unexpected null characters
warning: Memory read failed for corefile section, 1048576 bytes at 0x7f93756a6000.
warning: Memory read failed for corefile section, 1048576 bytes at 0x7f9379bec000.
...
warning: Memory read failed for corefile section, 1048576 bytes at 0x7f94c82dd000.
Saved corefile dump.24934
> ls -sh dump.24934
22G dump.24934
> /usr/lib/jvm/zulu-12-amd64/bin/jhsdb jmap --exe /usr/lib/jvm/zulu-12-amd64/bin/java --core dump.24934 --binaryheap --dumpfile jmap-dump.24934
Attaching to core dump.24934 from executable /usr/lib/jvm/zulu-12-amd64/bin/java, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 12.0.1+12
null
> ls -sh jmap-dump.24934
3.3M jmap-dump.24934
核心转储文件为22 Gb,而堆转储文件仅为3 Mb,因此很可能
jhsdb jmap
命令无法处理整个核心转储。此外,Eclipse MAT在打开堆转储文件时出现以下消息:The HPROF parser encountered a violation of the HPROF specification that it could not safely handle. This could be due to file truncation or a bug in the JVM.