Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using -XX:HeapDumpPath option but want to integrate the process id

When using -XX:+HeapDumpOnOutOfMemoryError the JVM will not overwrite the heap dump if there is already a dump file under the specified path. I want to be able to have multiple heap dumps in a non-default location, and was planning on using the pid in the heap dump path in order to allow that.

However, when I tried to specify the argument like so:

-XX:HeapDumpPath=some/heapdump/path/heapdump-%p.hprof

And then created a heap dump, I got %p and not the actual pid in the file name. However, the use of %p seems to work with the -XX:OnOutOfMemoryError option. Is there some other syntax that I'm supposed to use for -XX:HeapDumpPath=?

like image 320
Nina Avatar asked Jul 17 '14 17:07

Nina


1 Answers

That can be a path to a file OR directory. If you have a path to a directory, the generated file name will have pid in it by default.

http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html

like image 134
Brett Okken Avatar answered Sep 28 '22 06:09

Brett Okken