Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is the heap dump file created by jcmd?

Tags:

java

hprof

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?

like image 766
Robin Green Avatar asked Nov 28 '22 21:11

Robin Green


1 Answers

I had the same problem in windows.

jcmd 6232 GC.heap_dump filename=IShp1.hprof

it ran, said file created, but a search of c drive couldn't find it. Reran and got 'file exists'.

Tried with a path specified in filename, and a different file name,

jcmd 6232 GC.heap_dump filename=c:\temp\IShp2.hprof

This also got 'file exists'.

I conclude 'filename' is not being honored. Presumably jcmd is writing some internally-specified unknown file name to some unknown location, when the 'filename' is specified.

Instead

jcmd 6232 GC.heap_dump c:\temp\isHpdmp1.hprof

works and writes the file to the specified location. So presumably for *nix something like

jcmd 6232 GC.heap_dump /opt/temp/myHd.hprof 
like image 199
Douglas Kretzmann Avatar answered Dec 05 '22 12:12

Douglas Kretzmann