错误java.lang.OutOfMemoryError:超出GC开销限制 [英] Error java.lang.OutOfMemoryError: GC overhead limit exceeded

查看:163
本文介绍了错误java.lang.OutOfMemoryError:超出GC开销限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



  java.lang.OutOfMemoryError:超出了GC开销限制

我知道 OutOfMemoryError 是什么,但是什么GC开销限制是否意味着?如何解决这个问题?

解决方案

这个消息意味着垃圾收集器花费了大量的时间默认是进程的所有CPU时间的98%),并且在每次运行中恢复的内存非常少(默认为堆的2%)。



这实际上意味着你的程序为了防止应用程序在没有完成任何事情的情况下吸收CPU时间,JVM会抛出这个<

code> Error ,以便您有机会诊断问题。



我见过这种情况的罕见情况是其中一些代码在已经非常内存有限的环境中创建了大量的临时对象和大量弱引用的对象。



查看这篇文章了解详情(s pecifically 这部分)。

I get this error message as I execute my JUnit tests:

java.lang.OutOfMemoryError: GC overhead limit exceeded

I know what an OutOfMemoryError is, but what does GC overhead limit mean? How can I solve this?

解决方案

This message means that for some reason the garbage collector is taking an excessive amount of time (by default 98% of all CPU time of the process) and recovers very little memory in each run (by default 2% of the heap).

This effectively means that your program stops doing any progress and is busy running only the garbage collection at all time.

To prevent your application from soaking up CPU time without getting anything done, the JVM throws this Error so that you have a chance of diagnosing the problem.

The rare cases where I've seen this happen is where some code was creating tons of temporary objects and tons of weakly-referenced objects in an already very memory-constrained environment.

Check out this article for details (specifically this part).

这篇关于错误java.lang.OutOfMemoryError:超出GC开销限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆