XX:+ HeapDumpOnOutOfMemoryError最大文件大小限制 [英] XX:+HeapDumpOnOutOfMemoryError Max file size limit

查看:539
本文介绍了XX:+ HeapDumpOnOutOfMemoryError最大文件大小限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 XX:+ HeapDumpOnOutOfMemoryError JVM标志运行Java进程并看到以下输出:

I'm running a Java process with the XX:+HeapDumpOnOutOfMemoryError JVM flag and seeing 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 a way to get around this issue?

推荐答案

-XX:+ HeapDumpOnOutOfMemoryError 命令行选项告诉HotSpot VM在生成堆转储时生成堆转储无法满足Java堆或永久代的分配。运行此选项没有任何开销,因此它对于OutOfMemoryError需要很长时间才能浮出水面的生产系统非常有用。

The -XX:+HeapDumpOnOutOfMemoryError command-line option tells the HotSpot VM to generate a heap dump when an allocation from the Java heap or the permanent generation cannot be satisfied. There is no overhead in running with this option, and so it can be useful for production systems where OutOfMemoryError takes a long time to surface.

为了解决特定问题你所面对的,你可以使用以下纠正措施之一:

In order to resolve the specific problem that you are facing, you can use one of the following corrective measures:

措施1:
XX:HeapDumpSegmentSize

Measure 1: XX:HeapDumpSegmentSize


-XX:HeapDumpSegmentSize选项在生成分段HPROF堆转储时指定适当的段大小。

The -XX:HeapDumpSegmentSize option specifies an appropriate segment size when generating a segmented HPROF heap dump.

格式

-XX:HeapDumpSegmentSize = size [k | K] [m | M] [g | G]

-XX:HeapDumpSegmentSize=size[k|K][m|M][g|G]

示例

java -XX:+ HeapDumpOnOutOfMemory -XX :HeapDumpSegmentSize = 512M myApp

默认值

1 GB

Default Values
1 GB

措施2
-XX:SegmentedHeapDumpThreshold

Measure 2 -XX:SegmentedHeapDumpThreshold


-XX:SegmentedHeapDumpThreshold选项生成分段堆当堆使用量大于指定大小时转储(.hprof文件,1.0.2格式)。

The -XX:SegmentedHeapDumpThreshold option generates a segmented heap dump (.hprof file, 1.0.2 format) when the heap usage is larger than the specified size.

分段HPROF转储格式需要正确生成包含4 GB以上数据的堆转储。如果-XX:SegmentedHeapDumpThreshold选项的值设置为大于4 GB,则可能无法正确生成堆转储。

The segmented HPROF dump format is required to correctly generate heap dumps containing more than 4 GB of data. If the value of -XX:SegmentedHeapDumpThreshold option is set more than 4 GB, heap dumps may not be generated correctly.

格式

-XX:SegmentedHeapDumpThreshold = size

Format
-XX:SegmentedHeapDumpThreshold=size

示例

java -XX :SegmentedHeapDumpThreshold = 512M myApp

默认值

2 GB

Default Value
2 GB

这篇关于XX:+ HeapDumpOnOutOfMemoryError最大文件大小限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆