GC (Allocation Failure) [PSYoungGen]

时间:2018-11-13 07:49:51

标签: java garbage-collection

Recently we switched our code to java8 from java7. We are getting GC allocation failure in every 10 minuts for PSYoungGen. We even tried having switch -XX:NewSize and -XX:NewMaxSize in place to around 5GB(total heap size is 10GB). But even after gc allocation failure is getting printed and PSYoungGen is triggering to the almost the size(5GB). Added some logs :

[GC (Allocation Failure) [PSYoungGen: 3145728K->114922K(3670016K)] 3145728K->115026K(5767168K), 0.2511084 secs] [Times: user=0.26 sys=0.14, real=0.25 secs]
[GC (Allocation Failure) [PSYoungGen: 4443141K->125893K(4718592K)] 4443261K->126229K(6815744K), 0.2318927 secs] [Times: user=0.42 sys=0.22, real=0.24 secs]

In one of answers: Java GC (Allocation Failure) related to this I have seen this is normal behavior, just curious to know is there any way to overcome this ? Thanks.

1 个答案:

答案 0 :(得分:2)

我认为您可能要设置的NewSize控制着整个新一代(由伊甸园幸存者空间组成)的大小,所以也许您的伊甸园的大小仍然不足以直接分配给新的大对象(例如,大字节[]的对象)。

我要问的是,即使您将新设置为5Gb,我也认为Oracle's docs建议SurvivorRatio的默认值为8意味着大约{{1} }幸存者空间,剩下1.25Gb伊甸园。您是否可以分配大于或接近此大小的对象?

关于没有这样的日志,在您链接到OP中的答案中,可接受的答案会发表评论

  

“较早的JVM并没有打印出导致GC周期短的GC原因。

所以也许这一直在发生,而您只是直到现在才知道。

相关问题