How can I restart JVM on OutOfMemoryError _after_ making a heap dump?

后端 未结 3 1969
耶瑟儿~
耶瑟儿~ 2021-02-01 07:06

I know about the -XX:+HeapDumpOnOutOfMemoryError JVM parameter. I also know about -XX:OnOutOfMemoryError=\"cmd args;cmd args\" and that kill -3 will

3条回答
  •  鱼传尺愫
    2021-02-01 07:45

    java -XX:+HeapDumpOnOutOfMemoryError -XX:OnOutOfMemoryError="kill -9 %p" TestApp
    

    JVM will dump heap first, and then execute OnOutOfMemoryError commands (proof).

提交回复
热议问题