简体   繁体   English

重复使用可用堆的完整GC

[英]Repeated Full GC with available Heap

I'm experiencing repeated Full GCs even when the heap is not fully used. 即使没有充分使用堆,我也会遇到重复的Full GC。

This is how the gc logs look like: http://d.pr/i/iFug (the blue line is the used heap and the grey rectangles are Full GCs). gc日志如下所示: http : //d.pr/i/iFug (蓝线是已使用的堆,灰色矩形是Full GC)。

It seems to be a problem similar to the one posted in this question: Frequent full GC with empty heap 这似乎是与该问题中发布的问题类似的问题: 频繁的具有空堆的完整GC

However, that thread didn't provide any actual answers to the problem. 但是,该线程没有提供任何实际的问题答案。 My application does uses RMI, and the production servers are indeed using 1.6 before the Upgrade 45 that increased GC intervals from 1 min to 1 hour ( http://docs.oracle.com/javase/7/docs/technotes/guides/rmi/relnotes.html ). 我的应用程序确实使用RMI,并且在升级45之前生产服务器确实使用1.6,从而将GC间隔从1分钟增加到1小时( http://docs.oracle.com/javase/7/docs/technotes/guides/rmi /relnotes.html )。 However, from the rest of the log, I can't see that Full-GC-every-1-min pattern. 但是,从日志的其余部分来看,我看不到Full-GC-every-1-min模式。

What could possibly be causing this? 可能是什么原因造成的?

Most likely the cause is you have reached the current size of the heap. 原因很可能是您达到了当前的堆大小。 The size of the heap is smaller than the maximum you set and is adjusted as the program runs. 堆的大小小于您设置的最大值,并在程序运行时进行调整。

eg Say you set a maximum of 1 GB, the initial heap size might be 256 MB, and when you reach 256 MB it performs a full GC, after this GC it might decide that 400 MB would be a better size and when this is reach a full GC is performed etc. 例如,假设您设置的最大大小为1 GB,则初始堆大小可能为256 MB,当达到256 MB时,它将执行完整的GC,在此GC之后,它可能会决定400 MB为更好的大小,并且达到此大小时执行完整的GC等


You get a major collection when the tenured space fills or fails to find free space. 当保有权空间填满或找不到可用空间时,您将获得主要收藏。 Eg if it is fragmented. 例如,是否零散。

You also get full collections if your survivor spaces are too small. 如果幸存者空间太小,您还将获得全部收藏。

In short, the most likely cause is the gc tuning parameters you used. 简而言之,最可能的原因是您使用的gc调整参数。 I suggest you simplify your tuning parameters until your system behaves in a manner you expect. 我建议您简化调整参数,直到系统以预期的方式运行。

As noted in the linked thread, disable explicit GC and see if the FullGC pattern occurs again : -XX:+DisableExplicitGC . 如链接线程中所述,禁用显式GC并查看FullGC模式是否再次出现: -XX:+DisableExplicitGC The RMI code may be triggering explicit GC in given interval, which may not be desirable in some cases. RMI代码可能在给定的时间间隔内触发了显式GC,这在某些情况下可能不是所希望的。

If the FullGCs still occur, I would take thread dumps and possibly a heap dump to analyze the issue. 如果FullGC仍然发生,我将使用线程转储以及可能的堆转储来分析问题。

Also, use jstat to see the occupation of Eden, Survivor, OldGen spaces. 另外,使用jstat查看Eden,Survivor,OldGen空间的占用情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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