性能问答>JVM堆内存很富足,但仍经常连续发生两次full GC>
1回复

JVM堆内存很富足,但仍经常连续发生两次full GC



我遇到一个问题,请帮忙分析下,是什么原因导致的full gc:
现象很奇怪,经常性出现两次连续full gc,发生full gc时堆剩余内存还很富足。

环境:

java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

启动参数

java -server -Xms4096m -Xmx4096m -Xmn1536m -Xss256K -XX:PermSize=128m -XX:MaxPermSize=256m -XX:ReservedCodeCacheSize=64m -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:ParallelGCThreads=2 -XX:+UseBiasedLocking -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime

GC日志(发生full gc前后的gc日志)

T10:01:27.012+0800: 403507.772: Total time for which application threads were stopped: 0.0003780 seconds
T10:13:14.071+0800: 404214.832: [GC
Desired survivor size 117964800 bytes, new threshold 1 (max 15)
[PSYoungGen: 1333185K->10727K(1446912K)] 1452262K->131813K(4068352K), 0.0215750 secs] [Times: user=0.03 sys=0.00, real=0.03 secs]
T10:13:14.093+0800: 404214.854: Total time for which application threads were stopped: 0.0225360 seconds
此处省略类似的日志...
T10:13:14.102+0800: 404214.863: Total time for which application threads were stopped: 0.0002030 seconds
T10:13:14.238+0800: 404214.999: [GC
Desired survivor size 113246208 bytes, new threshold 1 (max 15)
[PSYoungGen: 23905K->5252K(1462272K)] 144991K->130159K(4083712K), 0.0078300 secs] [Times: user=0.01 sys=0.00, real=0.01 secs]
T10:13:14.246+0800: 404215.007: [Full GC [PSYoungGen: 5252K->0K(1462272K)] [ParOldGen: 124906K->121506K(2621440K)] 130159K->121506K(4083712K) [PSPermGen: 42425K->42351K(131072K)], 0.2893160 secs] [Times: user=0.51 sys=0.00, real=0.29 secs]
T10:13:14.535+0800: 404215.296: Total time for which application threads were stopped: 0.2980130 seconds
T10:14:14.512+0800: 404275.273: [GC
Desired survivor size 108003328 bytes, new threshold 1 (max 15)
[PSYoungGen: 18345K->5378K(1457664K)] 139852K->126885K(4079104K), 0.0060680 secs] [Times: user=0.01 sys=0.00, real=0.01 secs]
T10:14:14.519+0800: 404275.279: [Full GC [PSYoungGen: 5378K->0K(1457664K)] [ParOldGen: 121506K->121043K(2621440K)] 126885K->121043K(4079104K) [PSPermGen: 42351K->42351K(131072K)], 0.1845710 secs] [Times: user=0.32 sys=0.00, real=0.19 secs]
T10:14:14.703+0800: 404275.464: Total time for which application threads were stopped: 0.1917300 seconds
2713 阅读
请先登录,再评论

启动参数添加 -XX:+DisableExplicitGC,屏蔽掉System.GC试试,如果FullGC 不存在了,那么就是代码主动调用的FullGC。

1年前