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

被折叠的 条评论
为什么被折叠?



