If I take dump, using Windbg, of Java process running on Windows
Can I analyze (easly?) the Java heap, objects, and threads?
Just like I could do with SOS for .Net process?
Otherwise - how can I offline debug a problem happening on production systems?
Thanks!
有一个Java堆分析工具
Windows minidumps (.dmp) can be used with these utilities:
jvisualvm
utility from JDK can get you both thread dump and heap dump
jvisualvm
Applications
pane, find VM Coredumps
Add VM Coredump...
.dmp
minidump file OK
VM Coredumps
Thread Dump
Heap Dump
jstack
utility from JDK can show Java stack from Windows minidumps (.dmp)
Here's a batch script for that:
:: Shows java stack from Windows minidumps :: Argument %1: Path to minidump @ECHO OFF SET JDK_PATH=C:\\Program Files\\Java\\jdk1.8.0_181\\bin "%JDK_PATH%\\jstack.exe" "%JDK_PATH%\\java" "%~1" PAUSE
jmap
utility from JDK can convert Windows minidump (.dmp) to java heap dump (.hprof)
Here's a batch script for that:
:: Converts Windows minidump to Java heap dump (.hprof) :: Argument %1: Path to minidump @ECHO OFF SET JDK_PATH=C:\\Program Files\\Java\\jdk1.8.0_181\\bin "%JDK_PATH%\\jmap.exe" -F -dump:format=b,file="%~dpn1.hprof" "%JDK_PATH%\\java" "%~1" PAUSE
NetBeans 6.9.1 can load .hprof file (Profile -> Load Heap Dump). Then, for example, you can search for the biggest object and see it's internals.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.