javahprofjcmd

Where is the heap dump file created by jcmd?


I have tried to take a heap dump using jcmd (from a git bash console window):

$ /c/Program\ Files/Java/jdk1.8.0_202/bin/jcmd 25156 GC.heap_dump filename=livetest-grindtohalt.hprof
25156:
Heap dump file created

However, the file does not seem to exist:

$ find -name livetest-grindtohalt.hprof

$

Where can I find it?


Solution

  • The answer by Douglas Kretzmann sets you on the correct path to practical jcmd use. To answer the question from the original post, relative paths are resolved against the current working directory of the specified java process. So after

    jcmd 6232 GC.heap_dump heap.hprof
    

    you will be able to find heap.hprof in the directory output by

    lsof -p 6232 | grep cwd