The command line parameter instructs the -XX:+HeapDumpOnOutOfMemoryErrorHotSpot VM to generate a heap dump when allocation from a Java or permanent generation heap cannot be performed. In this case, there is no overhead, so it can be useful for production systems where OutOfMemoryError takes a lot of time.
To solve the specific problem you are facing, you can use one of the following corrective measures:
1:
XX: HeapDumpSegmentSize
-XX: HeapDumpSegmentSize HPROF.
-XX: HeapDumpSegmentSize = [k | K] [m | M] [g | G]
java -XX:+HeapDumpOnOutOfMemory -XX:HeapDumpSegmentSize=512M myApp
1
2
-XX: SegmentedHeapDumpThreshold
-XX: SegmentedHeapDumpThreshold ( .hprof, 1.0.2), .
, 4 , HPROF. -XX: SegmentedHeapDumpThreshold 4 , .
-XX: SegmentedHeapDumpThreshold =
java -XX:SegmentedHeapDumpThreshold=512M myApp
2