Periodically our application encounters promotion failures when running the CMS collector, presumably due to a fragmented Tenured space. Once the first failure occurs, we tend to see subsequent failures at lower occupancies of Tenured space. For example, the first promotion failure might occur when Tenured is 70% full, the next 68%, then 65%, ... you get the picture. So my question is whether a compaction will ever be performed to resolve the fragmentation?<br>
<br><br>I'm not a programmer, but I see comments in concurrentMarkSweepGeneration.cpp that lead me to believe that a compact would happen if UseCMSCompactAtFullCollection is set to TRUE and the threshold set by CMSFullGCsBeforeCompaction has been exceeded. However, since the defaults are TRUE and 0 respectively, I would think that the first Full GC triggered by a promotion failure would perform a compact. Apparently I'm missing something.<br>
<br>Commets from concurrentMarkSweepGeneration.cpp<br> // Normally, we'll compact only if the UseCMSCompactAtFullCollection<br> // flag is set, and we have either requested a System.gc() or<br> // the number of full gc's since the last concurrent cycle<br>
// has exceeded the threshold set by CMSFullGCsBeforeCompaction,<br> // or if an incremental collection has failed<br><br><br>Any clarification in this matter would be appreciated.<br><br>FYI, normally we are able to avoid promotion failures by setting CMSOccupancyFraction to an aggressive number such as 50, though this comes at the cost of a much larger heap and slower minor collections.<br>
<br>Thanks,<br>Shane<br>