G1垃圾收集 - 重复完整GC - 这是否代表堆碎片/垃圾压缩问题?

时间:2015-06-03 13:51:07

标签: java g1gc

我正在使用Java 7更新76和G1垃圾收集器。

我们会定期以较短的时间间隔(每4到5秒)体验一次完整的GC,看起来内存正在被释放,但是很快就会发生另一个完整的gc,并且似乎再次释放了相似数量的内存。

这是否表示堆碎片/垃圾压缩问题?

Line 21068: 2015-05-27T04:58:38.527+0100: 2792829.022: [Full GC 3987M->236M(4096M), 0.6266670 secs]
Line 21084: 2015-05-27T04:58:46.744+0100: 2792837.238: [Full GC 3901M->237M(4096M), 0.6240680 secs]
Line 21101: 2015-05-27T04:58:51.303+0100: 2792841.797: [Full GC 3991M->238M(4096M), 0.6463980 secs]
Line 21118: 2015-05-27T04:58:55.561+0100: 2792846.055: [Full GC 3903M->238M(4096M), 0.6273730 secs]
Line 21130: 2015-05-27T04:58:59.747+0100: 2792850.241: [Full GC 3901M->238M(4096M), 0.6414350 secs]
Line 21146: 2015-05-27T04:59:04.128+0100: 2792854.623: [Full GC 3902M->237M(4096M), 0.6291800 secs]
Line 21158: 2015-05-27T04:59:08.363+0100: 2792858.857: [Full GC 3902M->239M(4096M), 0.6308080 secs]
Line 21169: 2015-05-27T04:59:12.536+0100: 2792863.031: [Full GC 3814M->240M(4096M), 0.6440340 secs]
Line 21185: 2015-05-27T04:59:18.000+0100: 2792868.495: [Full GC 3905M->239M(4096M), 0.6270340 secs]
Line 21197: 2015-05-27T04:59:22.217+0100: 2792872.711: [Full GC 3902M->239M(4096M), 0.6288050 secs]
Line 21208: 2015-05-27T04:59:26.389+0100: 2792876.883: [Full GC 3902M->239M(4096M), 0.6330140 secs]
Line 21224: 2015-05-27T04:59:30.610+0100: 2792881.104: [Full GC 3904M->239M(4096M), 0.6279680 secs]
Line 21236: 2015-05-27T04:59:34.758+0100: 2792885.253: [Full GC 3813M->239M(4096M), 0.6295690 secs]
Line 21247: 2015-05-27T04:59:38.928+0100: 2792889.422: [Full GC 3903M->239M(4096M), 0.6315110 secs]
Line 21258: 2015-05-27T04:59:43.260+0100: 2792893.754: [Full GC 3814M->240M(4096M), 0.6532740 secs]
Line 21274: 2015-05-27T04:59:49.461+0100: 2792899.955: [Full GC 3993M->239M(4096M), 0.6340010 secs]
Line 21286: 2015-05-27T04:59:53.765+0100: 2792904.260: [Full GC 3903M->240M(4096M), 0.6300460 secs]

在此重复的完整gc重复行为发生之前,系统可以正常运行一个月......

2 个答案:

答案 0 :(得分:2)

这不太可能是G1特定的问题(尝试另一个收集器,可能会发生同样的事情)。您的应用中的流失率非常高。像yourkit这样的工具非常适合追踪主犯。

答案 1 :(得分:0)

我使用了eclipse MATYour kit。两者都很好。 我的几个朋友正在使用class loader memory leak tool。我听到很多关于它的好消息。 This is good article about this class loader memory leak prevention jar。请注意: - 只有战争。