XX: + HeapDumpOnOutOfMemoryError Maximum file size

I start a Java process with the XX:+HeapDumpOnOutOfMemoryErrorJVM flag and see the following output:

java.lang.OutOfMemoryError: Java heap space
Dumping heap to /local/disk2/heaps/heapdump.hprof ...
Dump file is incomplete: file size limit

Is there any way around this problem?

+4
source share
2 answers

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

+4

:
.

- , JVM -XX: HeapDumpPath (. ).

+1

All Articles