does CMS collector ever compact?

Jon Masamitsu Jon.Masamitsu at Sun.COM
Fri Oct 24 20:43:55 UTC 2008

If a promotion failure occurs, the heap is compacted with the
default settings for UseCMSCompactAtFullCollection and
CMSFullGCsBeforeCompaction.   What are all the command
line flags that you use?

Shane Cox wrote On 10/24/08 13:16,:

> 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?
> 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.
> Commets from concurrentMarkSweepGeneration.cpp
>   // Normally, we'll compact only if the UseCMSCompactAtFullCollection
>   // flag is set, and we have either requested a System.gc() or
>   // the number of full gc's since the last concurrent cycle
>   // has exceeded the threshold set by CMSFullGCsBeforeCompaction,
>   // or if an incremental collection has failed
> Any clarification in this matter would be appreciated.
> 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.
> Thanks,
> Shane
>hotspot-gc-use mailing list
>hotspot-gc-use at

hotspot-gc-use mailing list
hotspot-gc-use at

More information about the hotspot-gc-dev mailing list