简体   繁体   中英

GC (Allocation Failure) [PSYoungGen]

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.

I think it is the case that the NewSize you might be setting is controlling the size of the entire new generation (which is composed of eden and survivor spaces) so perhaps your eden is still not sufficiently sized to allocate directly into for new large objects (perhaps large byte[]'s for example).

What I am questioning is that even if you set the new to 5Gb , I think Oracle's docs suggest with SurvivorRatio default being 8 would mean approx 1.25Gb of survivor space, leaving 3.75 Gb eden. Is it possible you allocate objects above or close to this size?

With regards to the no such logs, in the answer you link to in your OP the accepted answer makes the comment

"Older JVM were not printing GC cause for minor GC cycles.

So perhaps this was always happening and you just didn't know until now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM