Hi All ,
I have a situation where we get an OutOfMemory error. I want to create a thread dump when that condition occurs.
I was thinking of going with the following java startup parameter
-XX:OnOutOfMemoryError="kill -3 pid"
-verbose:gc -Xmx1024M -Xms512M -XX:MaxPermSize=128M -XX:NewRatio=2 -XX:+PrintGCTimeStamps -XX:+UseTLAB -XX:+PrintGCDetails -XX:+PrintClassHistogram -XX:+HeapDumpOnOutOfMemoryError -XX:OnOutOfMemoryError="kill -3 pid"
Will that work? Will it grab the pid automatically or do I need to supply it?
thanks and regards
Well, you won't know the PID number of the JVM's process until you start it, so providing it before you start the process obviously isn't going to be possible.
At any rate I suggest you... try it and see what happens. It isn't hard to write five lines of code which quickly uses up all available memory.