JVM运行报错:GC overhead limit exceeded

今天在折腾OOM和java的4种引用类型的时候,在运行过程中JVM报了一个错误:

java.lang.OutOfMemoryError: GC overhead limit exceeded 

这个错误平时遇到的概率很少很少,今天无意中遇到了,这里做个记录。oracle/sun官网的解释是:

The 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.

我使用的是JDK1.6.0_37和JDK_1.7.0_60版本,这2个版本中JVM默认启动的时候-XX:+UseGCOverheadLimit,即启用了该特性。这其实是JVM的一种推断,如果垃圾回收耗费了98%的时间,但是回收的内存还不到2%,那么JVM会认为即将发生OOM,让程序提前结束。当然我们可以使用-XX:-UseGCOverheadLimit,关掉这个特性。

不太明白为什么JDK要提供这么个参数。当我们遇到这个错误只能说明:要么是内存空间不足,要么是存在内存泄露。这个时候对我们有意义的,其实就是heap dump,我们可以分析堆内存的情况,从而诊断出是否代码存在问题。

我们知道如果在启动JVM的时候设置了如下的参数,那么JVM崩溃的时候会打印出heap dump。

-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=C:/  

个人感觉,如果真的发生了"GC overhead limit exceeded"错误,那么其实离实际的OOM已经不远了,所以让JVM做个预测提前结束,感觉意义不大。

时间: 2024-08-10 02:10:41

JVM运行报错:GC overhead limit exceeded的相关文章

IDEA报错:GC overhead limit exceeded?

1. 问题描述 在运行代码之后,出现以下错误: Exception in thread "main" org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 107.0 failed 1 times, most recent failure: Lost task 0.0 in stage 107.0 (TID 208, localhost, executor driver):

Eclipse启动报错:An internal error occurred during: "Building workspace". GC overhead limit exceeded

今天启动Eclipse时发现右下角的building workspce走到2%时,不动了,Eclipse好长时间没反应,然后弹出错误信息:An internal error occurred during: "Building workspace". GC overhead limit exceeded. 如下图: 上网搜了一下,说是要修改一下Eclipse安装下的eclipse.ini文件,增加Eclipse实例的内存分配,.打开eclipse.ini文件,内容如下: [html]

eclipse一直报An internal error occurred during: "Building workspace". GC overhead limit exceeded

最近导入到eclipse里的工程挺大的,每次eclipse启动之后都回update workspace,然后就一直报: An internal error occurred during: "Building workspace". GC overhead limit exceeded 这个错误. 解决方法: 原因是Eclipse默认配置内存太小需要更改Eclipse安装文件夹下的eclipse.ini文件. Eclipse.ini默认文件如下: 修改如下: -Xms512m -Xmx

spark 读取mongodb失败,报executor time out 和GC overhead limit exceeded 异常

代码: import com.mongodb.spark.config.ReadConfig import com.mongodb.spark.sql._ val config = sqlContext.sparkContext.getConf .set("spark.mongodb.keep_alive_ms", "15000") .set("spark.mongodb.input.uri", "mongodb://10.100.12

eclipse:gc overhead limit exceeded

转自:http://jingyan.baidu.com/article/0a52e3f419f60dbf62ed7212.html 大家经常遇到运行java程序内存不足修改内存不足的方法如下:Eclipse报错:gc overhead limit exceeded eclipse原因是Eclipse默认配置内存太小需要更改Eclipse安装文件夹下的eclipse.ini文件.修改如下:-Xms512m -Xmx1024m第一个是最小的初始化内存,第二个是最大的占有内存还可以加上 -XX:Max

java.lang.OutOfMemoryError GC overhead limit exceeded原因分析及解决方案

最近一个上线运行良好的项目出现用户无法登录或者执行某个操作时,有卡顿现象.查看了日志,出现了大量的java.lang.OutOfMemoryError: GC overhead limit exceeded错误. oracle官方给出了这个错误产生的原因和解决方法: Exception in thread thread_name: java.lang.OutOfMemoryError: GC Overhead limit exceeded Cause: The detail message "G

排查java.lang.OutOfMemoryError: GC overhead limit exceeded

帮助客户排查java.lang.OutOfMemoryError: GC overhead limit exceeded错误记录: 具体网址: https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=269134815562958&id=1554559.1&displayIndex=2&_afrWindowMode=0&_adf.ctrl-state=2t8bqbn6s_165 文档id: 155455

[Hadoop] - Hadoop Mapreduce Error: GC overhead limit exceeded

在运行mapreduce的时候,出现Error: GC overhead limit exceeded,查看log日志,发现异常信息为 2015-12-11 11:48:44,716 FATAL [main] org.apache.hadoop.mapred.YarnChild: Error running child : java.lang.OutOfMemoryError: GC overhead limit exceeded at java.io.DataInputStream.readU

Spark 1.4.1中Beeline使用的gc overhead limit exceeded

最近使用SparkSQL做数据的打平操作,就是把多个表的数据经过关联操作导入到一个表中,这样数据查询的过程中就不需要在多个表中查询了,在数据量大的情况下,这样大大提高了查询效率. 我启动了thriftserver,然后通过beeline去连接thriftserver, 打平操作进行的很顺利,但是在执行groupby操作的时候beeline报了一个错误:gc overhead limit exceeded 我分析可能是thriftserver报的错误.但是查看了thriftserver的日志没有任