Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded
2016-04-19 15:30
288 查看
Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded问题的解决办法.
一、异常如下:
Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded
二、产生原因:
意味着太多的时间花在了垃圾收集上面,SUN的建议是指定垃圾回收的算法,加上启动参数-XX:-UseGCOverheadLimit,从而限制JVM在抛出OutOfMemoryError之前限制其耗费在GC上的时间。
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 *** 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.
jvm gc行动中跨越98%以上的时间去释放小于2%的堆空间时会报这个错误。
JDK6新增错误类型。当GC为释放很小空间占用大量时间时抛出。
一般是因为堆太小。导致异常的原因:没有足够的内存。
三、解决方案:
1、查看系统是否有使用大内存的代码或死循环。
2、可以添加JVM的启动参数来限制使用内存:-XX:-UseGCOverheadLimit
3、在bin/catalina.sh增大Xms和Xmx:
JAVA_OPTS=””-Xms512m -Xmx4096m -XX:MaxPermSize=128m -XX:-UseGCOverheadLimit -XX:+UseConcMarkSweepGC””
-Xms512m 初始的java内存堆大小 256M
-Xmx4096m 最大的java内存堆大小 2048M
-XX:PermSize=128m GC预留的内存,假如你的应用有大量的Class被动态载进或卸载,你应该不这个参数设大些
-XX:MaxPermSize=256m 最大的GC预留内存
-Dsun.rmi.dgc.client.gcInterval=3600000 RMI客户端GC发生周期的设定
-Dsun.rmi.dgc.server.gcInterval=3600000 RMI服务端GC发生周期的设定
四、java命令
1、jps 类似UNIX的ps命令
2、jstat 用于输出给定java进程的统计信息。
3、jmap JAVA Memory Map
4、jconsole Java Monitoring and Management Console
一、异常如下:
Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded
二、产生原因:
意味着太多的时间花在了垃圾收集上面,SUN的建议是指定垃圾回收的算法,加上启动参数-XX:-UseGCOverheadLimit,从而限制JVM在抛出OutOfMemoryError之前限制其耗费在GC上的时间。
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 *** 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.
jvm gc行动中跨越98%以上的时间去释放小于2%的堆空间时会报这个错误。
JDK6新增错误类型。当GC为释放很小空间占用大量时间时抛出。
一般是因为堆太小。导致异常的原因:没有足够的内存。
三、解决方案:
1、查看系统是否有使用大内存的代码或死循环。
2、可以添加JVM的启动参数来限制使用内存:-XX:-UseGCOverheadLimit
3、在bin/catalina.sh增大Xms和Xmx:
JAVA_OPTS=””-Xms512m -Xmx4096m -XX:MaxPermSize=128m -XX:-UseGCOverheadLimit -XX:+UseConcMarkSweepGC””
-Xms512m 初始的java内存堆大小 256M
-Xmx4096m 最大的java内存堆大小 2048M
-XX:PermSize=128m GC预留的内存,假如你的应用有大量的Class被动态载进或卸载,你应该不这个参数设大些
-XX:MaxPermSize=256m 最大的GC预留内存
-Dsun.rmi.dgc.client.gcInterval=3600000 RMI客户端GC发生周期的设定
-Dsun.rmi.dgc.server.gcInterval=3600000 RMI服务端GC发生周期的设定
四、java命令
1、jps 类似UNIX的ps命令
2、jstat 用于输出给定java进程的统计信息。
3、jmap JAVA Memory Map
4、jconsole Java Monitoring and Management Console
相关文章推荐
- 《struts2》框架第一个实例的搭建
- Java7 新特性
- 旧的Eclipse迁移到Android Studio中碰到的图片iCCP问题解决
- Struts2文件上传拦截器问题
- Eclipse构建Maven项目
- java 反序列化漏洞检测及修复
- Summary of java stream classes
- java synchronized详解
- java 根据OU获取Windows的AD域账户
- Javadoc使用
- 2016.4.18 美图笔试(Java岗)
- java FileWriter and FileReader
- Spring+Quartz实现定时任务的配置方法
- JAVA实现K-means聚类
- Spring @Conditional注解的使用
- Java的线程模型
- Java-单机版的书店管理系统(练习设计模块和思想_系列 七 )
- Java-单机版的书店管理系统(练习设计模块和思想_系列 七 )
- 深入理解java的抽象类和接口
- java Spring 在WEB应用中的实例化