Java GC(分配失败) [英] Java GC (Allocation Failure)

查看:807
本文介绍了Java GC(分配失败)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么总是出现GC(分配失败)?

用于linux-amd64 JRE的Java HotSpot(TM)64位服务器VM(25.25-b02) ( 1.8.0_25 -b17),

  CommandLine标志:
-XX:CMSInitiatingOccupancyFraction = 60
-XX:GCLogFileSize = 10485760
-XX:+ HeapDumpOnOutOfMemoryError
-XX:InitialHeapSize = 32212254720
-XX:MaxHeapSize = 32212254720
-XX:NewRatio = 10
-XX:OldPLABSize = 16
-XX:ParallelGCThreads = 4
-XX:+ PrintGC
-XX:+ PrintGCDetails
-XX:+ PrintGCTimeStamps
-XX:+ PrintStringTableStatistics
-XX:+ PrintTenuringDistribution
-XX:StringTableSize = 1000003
-XX:SurvivorRatio = 4
-XX:TargetSurvivorRatio = 50
-XX:+ UseCompressedClassPointers
-XX:+ UseCompressedOops
-XX:+ UseParNewGC
-XX:+ UseConcMarkSweepGC





  27.329:[GC(分配失败)27.329:[ParNew 
希望的生存者大小44728320字节,新的门槛15 (最大15)
- 年龄1:16885304字节,16885304总计
:349568K-> 16618K(436928K),0.2069129秒] 349568K-> 16618K(31369920K),0.2070712秒] [Times:user = 0.78 sys = 0.04,real = 0.21秒]


28.210:[GC(分配失败)28.210:[ParNew
希望的幸存者大小44728320字节,新的阈值15 15)
- 年龄1:28866504字节,28866504总计
- 年龄2:12582536字节,41449040总计
:366186K-> 47987K(436928K),0.2144807秒] 366186K-> 47987K (分配失败)29.038:[ParNew
(0)希望的幸存者大小44728320字节,新的阈值2(最大15)
- 年龄1:28443488字节,28443488总计
- 年龄2:28386624字节,56830112总计
- 年龄3:12579928字节, 69410040总计
:397555K-> 76018K(436928K),0.2357352秒] 397555K-> 76018K(31369920K),0.2358535秒] [时间:用户= 0.93 sys = 0.01,再al = 0.23 secs]


解决方案

Allocation Failureis a GC周期的原因。



<分配失败>意味着Eden没有更多的空间来分配对象。所以,这是年轻GC的正常原因。



旧的JVM不打印GC导致次要的GC周期。



分配失败几乎只是小GC的可能原因。轻微GC启动的另一个原因可能是CMS备注阶段(如果 + XX:+ ScavengeBeforeRemark 已启用)。


Why it was always "GC (Allocation Failure)"?

Java HotSpot(TM) 64-Bit Server VM (25.25-b02) for linux-amd64 JRE (1.8.0_25-b17),

CommandLine flags: 
-XX:CMSInitiatingOccupancyFraction=60 
-XX:GCLogFileSize=10485760 
-XX:+HeapDumpOnOutOfMemoryError 
-XX:InitialHeapSize=32212254720 
-XX:MaxHeapSize=32212254720 
-XX:NewRatio=10 
-XX:OldPLABSize=16 
-XX:ParallelGCThreads=4 
-XX:+PrintGC 
-XX:+PrintGCDetails 
-XX:+PrintGCTimeStamps 
-XX:+PrintStringTableStatistics 
-XX:+PrintTenuringDistribution 
-XX:StringTableSize=1000003 
-XX:SurvivorRatio=4 
-XX:TargetSurvivorRatio=50 
-XX:+UseCompressedClassPointers 
-XX:+UseCompressedOops
-XX:+UseParNewGC 
-XX:+UseConcMarkSweepGC

27.329: [GC (Allocation Failure) 27.329: [ParNew
Desired survivor size 44728320 bytes, new threshold 15 (max 15)
- age   1:   16885304 bytes,   16885304 total
: 349568K->16618K(436928K), 0.2069129 secs] 349568K->16618K(31369920K), 0.2070712 secs] [Times: user=0.78 sys=0.04, real=0.21 secs]


28.210: [GC (Allocation Failure) 28.210: [ParNew
Desired survivor size 44728320 bytes, new threshold 15 (max 15)
- age   1:   28866504 bytes,   28866504 total
- age   2:   12582536 bytes,   41449040 total
: 366186K->47987K(436928K), 0.2144807 secs] 366186K->47987K(31369920K), 0.2146024 secs] [Times: user=0.84 sys=0.01, real=0.22 secs]


29.037: [GC (Allocation Failure) 29.038: [ParNew
Desired survivor size 44728320 bytes, new threshold 2 (max 15)
- age   1:   28443488 bytes,   28443488 total
- age   2:   28386624 bytes,   56830112 total
- age   3:   12579928 bytes,   69410040 total
: 397555K->76018K(436928K), 0.2357352 secs] 397555K->76018K(31369920K), 0.2358535 secs] [Times: user=0.93 sys=0.01, real=0.23 secs]

解决方案

"Allocation Failure" is a cause of GC cycle to kick.

"Allocation Failure" means that no more space left in Eden to allocate object. So, it is normal cause of young GC.

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

"Allocation Failure" is almost only possible cause for minor GC. Another reason for minor GC to kick could be CMS remark phase (if +XX:+ScavengeBeforeRemark is enabled).

这篇关于Java GC(分配失败)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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