您的位置:首页 > 编程语言 > Java开发

java异常:java.lang.OutOfMemoryError: GC overhead limit exceeded

2012-12-18 09:36 387 查看
这个是JDK6新添的错误类型。是发生在GC占用大量时间为释放很小空间的时候发生的,是一种保护机制。解决方案是,关闭该功能,使用—— 
-XX:-UseGCOverheadLimit

 
这里要查看是否有使用大内存的代码或死循环。
 
Sun官方解释:
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
一、异常如下:
Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded
二、解释:

JDK6新增错误类型。当GC为释放很小空间占用大量时间时抛出。

一般是因为堆太小。导致异常的原因:没有足够的内存。
三、解决方案:

1、查看系统是否有使用大内存的代码或死循环。

2、可以添加JVM的启动参数来限制使用内存:-XX:-UseGCOverheadLimit
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Class JAVA JDK