问题描述
使用 -XX:+ HeapDumpOnOutOfMemoryError
时,如果指定路径下已存在转储文件,则JVM不会覆盖堆转储。我希望能够在非默认位置拥有多个堆转储,并且计划在堆转储路径中使用pid以允许它。
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
然后创建堆转储,我得到%p
而不是文件名中的实际pid。但是,使用%p
似乎可以使用 -XX:OnOutOfMemoryError
选项。是否有其他语法我应该用于 -XX:HeapDumpPath =
?
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=
?
推荐答案
这可以是文件OR目录的路径。如果你有一个目录路径,默认情况下生成的文件名将包含pid。
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.
这篇关于使用-XX:HeapDumpPath选项但希望集成进程ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!