Is it possible to get Java heap dumps when the Linux Core dumps itself is disabled?
Thanks Dhanush
Yes. Java heap dumps and Linux core dumps are produced by completely different mechanisms.
Java Heap Dumps are independent of Linux Core Dumps.
To get a Heap Dump, you can use :
-XX:+HeapDumpOnOutOfMemory
Once you have the dump, you can then analyse it using a tool such as Eclipse MAT.
OS core dump and Java Heap dump are not related. OS dump is in control of the OS and Java heap dump is in control of JRE
There are great tools like Eclipse MAT and Heap Hero to analyze heap dumps. However, you need to provide these tools with heap dumps captured in the correct format and correct point in time.
This article gives you multiple options to capture heap dumps. However, in my opinion, first 3 are effective options to use and others are good options to be aware.
1. jmap
Here is how you should invoke jmap:
jmap -dump:format=b,file=<file-path> <pid>
where
pid: is the Java Process Id, whose heap dump should be captured
file-path: is the file path where heap dump will be written in to.
2. HeapDumpOnOutOfMemoryError
Sample Usage:
-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/opt/tmp/heapdump.bin
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.