java.lang.OutOfMemoryError: GC overhead limit exceeded

本文介绍了一种在JVM中出现的新错误类型:当98%的时间用于垃圾回收(GC),而堆内存恢复不到2%时触发的OutOfMemoryError。文章解释了这一机制的设计目的,并提供了避免该错误的方法,包括禁用该特性或调整堆大小。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


The parallel / concurrent collector will throw an OutOfMemoryError if too much time is being spent in garbage collection: if more than 98% of the total time is spent in garbage collection and less than 2% of the heap is recovered, an OutOfMemoryError will be thrown. This feature is designed to prevent applications from running for an extended period of time while making little or no progress because the heap is too small. If necessary, this feature can be disabled by adding the option -XX:-UseGCOverheadLimit to the command line


这个是JDK6新添的错误类型。在JVM中如果98%的时间是用于GC且可用的 Heap size 不足2%的时候将抛出此异常信息。可以关闭该功能,使用—— -XX:-UseGCOverheadLimit

或者增加堆大小

Heap size的 -Xms  设置不要超出物理内存的大小。否则会提示“Error occurred during initialization of VM Could not reserve enough space for object heap”。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值