一、异常如下:Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded
二、解释:JDK6新增错误类型。当GC为释放很小空间占用大量时间时抛出。一般是因为堆太小。导致异常的原因:没有足够的内存。
三、解决方案: 1、查看系统是否有使用大内存的代码或死循环。2、可以添加JVM的启动参数来限制使用内存:-XX:-UseGCOverheadLimit
这个是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

本文解析了Java运行时出现的“GC overhead limit exceeded”错误,这是一种在垃圾回收过程中消耗过多时间而产生的异常。文章探讨了其触发原因,并提供了禁用此功能及排查内存泄漏的方法。
1476

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



