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=?