- Good: very quick snapshotting even for large heap spaces (e.g. works if your JVM process would otherwise timeout and die)
- Bad: such a memory snapshot contains significantly less useful information than YourKit's "enhanced" memory snapshots.
# 1. Find the relevant JVM pid on the target machine
$ ps ...
# 2. Perform a core dump with gdb
$ sudo gdb --pid=1234
(gdb) gcore /tmp/worker-jvm.core # <<< careful, don't fill up the partition!
Saved corefile /tmp/worker-jvm.core
(gdb)detach # <<< do this as soon as possible b/c JVM hangs until you detach
(gdb)quit
# 3. Extract JVM heap from core dump
$ sudo /path/to/jdk/bin/jmap \
-dump:format=b,file=/tmp/worker-jvm.hprof \
/usr/bin/java /tmp/worker-jvm.core
# 4. Open *.hprof file in YourKit via File > Open Snapshot...