Faster heap dumps with GDB

Using jmap to create a heap dump directly on a JVM can create significant pause times if the heap is large. This may not be acceptable in a production environment where options are limited. An alternative option is to use GDB (GNU Debugger) to attach to the process, create a core file, and convert this using jmap to a hprof offline. This can reduce pause time impact a JVM and be processed faster offline with jmap.

gdb program <java pid>

gdb>gcore <filepath>

gdb>detach

now use jmap to create a hprof file for analysis

jmap -dump:format=b,file=<filename>.hprof <javadir> <source.core.file>