java虚拟机常见的错误 -- gc overhead limit exceeded
根据sun官方的说法是:“if too much time is being spent in garbagecollection: if more than 98% of the total time is spent in garbagecollection and less than 2% of the heap is recovered, anOutOfMemoryError will
·
根据sun官方的说法是:
“if too much time is being spent in garbagecollection: if more than 98% of the total time is spent in garbagecollection and less than 2% of the heap is recovered, anOutOfMemoryError will be thrown.”
意思是如果有98%的时间用来回收小于2%的堆空间时,会出现这个错误。
这个错误个人认为,是为了从时间效率角度来度量的,告诉人们这样做效率太低,需要优化。
本人产生这个问题的原因在于:
在 for 循环中,调用了system.gc()这个方法来进行垃圾回收。
解决这个问题的办法是:
在jvm启动参数中添加"-XX:-UseGCOverheadLimit"
更多推荐
已为社区贡献3条内容
所有评论(0)