简体   繁体   中英

Repeated Full GC with available Heap

I'm experiencing repeated Full GCs even when the heap is not fully used.

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).

It seems to be a problem similar to the one posted in this question: Frequent full GC with empty heap

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 ). However, from the rest of the log, I can't see that Full-GC-every-1-min pattern.

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.


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. 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 . The RMI code may be triggering explicit GC in given interval, which may not be desirable in some cases.

If the FullGCs still occur, I would take thread dumps and possibly a heap dump to analyze the issue.

Also, use jstat to see the occupation of Eden, Survivor, OldGen spaces.

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