894 |
894 |
895 bool ConcurrentMarkSweepGeneration::promotion_attempt_is_safe(size_t max_promotion_in_bytes) const { |
895 bool ConcurrentMarkSweepGeneration::promotion_attempt_is_safe(size_t max_promotion_in_bytes) const { |
896 size_t available = max_available(); |
896 size_t available = max_available(); |
897 size_t av_promo = (size_t)gc_stats()->avg_promoted()->padded_average(); |
897 size_t av_promo = (size_t)gc_stats()->avg_promoted()->padded_average(); |
898 bool res = (available >= av_promo) || (available >= max_promotion_in_bytes); |
898 bool res = (available >= av_promo) || (available >= max_promotion_in_bytes); |
899 if (PrintGC && Verbose) { |
899 if (Verbose && PrintGCDetails) { |
900 gclog_or_tty->print_cr( |
900 gclog_or_tty->print_cr( |
901 "CMS: promo attempt is%s safe: available("SIZE_FORMAT") %s av_promo("SIZE_FORMAT")," |
901 "CMS: promo attempt is%s safe: available("SIZE_FORMAT") %s av_promo("SIZE_FORMAT")," |
902 "max_promo("SIZE_FORMAT")", |
902 "max_promo("SIZE_FORMAT")", |
903 res? "":" not", available, res? ">=":"<", |
903 res? "":" not", available, res? ">=":"<", |
904 av_promo, max_promotion_in_bytes); |
904 av_promo, max_promotion_in_bytes); |
1560 // this is not likely to be productive in practice because it's probably too |
1560 // this is not likely to be productive in practice because it's probably too |
1561 // late anyway. |
1561 // late anyway. |
1562 GenCollectedHeap* gch = GenCollectedHeap::heap(); |
1562 GenCollectedHeap* gch = GenCollectedHeap::heap(); |
1563 assert(gch->collector_policy()->is_two_generation_policy(), |
1563 assert(gch->collector_policy()->is_two_generation_policy(), |
1564 "You may want to check the correctness of the following"); |
1564 "You may want to check the correctness of the following"); |
1565 if (gch->incremental_collection_will_fail()) { |
1565 if (gch->incremental_collection_will_fail(true /* consult_young */)) { |
1566 if (PrintGCDetails && Verbose) { |
1566 if (Verbose && PrintGCDetails) { |
1567 gclog_or_tty->print("CMSCollector: collect because incremental collection will fail "); |
1567 gclog_or_tty->print("CMSCollector: collect because incremental collection will fail "); |
1568 } |
1568 } |
1569 return true; |
1569 return true; |
1570 } |
1570 } |
1571 |
1571 |
1925 GenCollectedHeap* gch = GenCollectedHeap::heap(); |
1925 GenCollectedHeap* gch = GenCollectedHeap::heap(); |
1926 assert(gch->collector_policy()->is_two_generation_policy(), |
1926 assert(gch->collector_policy()->is_two_generation_policy(), |
1927 "You may want to check the correctness of the following"); |
1927 "You may want to check the correctness of the following"); |
1928 // Inform cms gen if this was due to partial collection failing. |
1928 // Inform cms gen if this was due to partial collection failing. |
1929 // The CMS gen may use this fact to determine its expansion policy. |
1929 // The CMS gen may use this fact to determine its expansion policy. |
1930 if (gch->incremental_collection_will_fail()) { |
1930 if (gch->incremental_collection_will_fail(false /* don't consult_young */)) { |
1931 assert(!_cmsGen->incremental_collection_failed(), |
1931 assert(!_cmsGen->incremental_collection_failed(), |
1932 "Should have been noticed, reacted to and cleared"); |
1932 "Should have been noticed, reacted to and cleared"); |
1933 _cmsGen->set_incremental_collection_failed(); |
1933 _cmsGen->set_incremental_collection_failed(); |
1934 } |
1934 } |
1935 *should_compact = |
1935 *should_compact = |
1936 UseCMSCompactAtFullCollection && |
1936 UseCMSCompactAtFullCollection && |
1937 ((_full_gcs_since_conc_gc >= CMSFullGCsBeforeCompaction) || |
1937 ((_full_gcs_since_conc_gc >= CMSFullGCsBeforeCompaction) || |
1938 GCCause::is_user_requested_gc(gch->gc_cause()) || |
1938 GCCause::is_user_requested_gc(gch->gc_cause()) || |
1939 gch->incremental_collection_will_fail()); |
1939 gch->incremental_collection_will_fail(true /* consult_young */)); |
1940 *should_start_over = false; |
1940 *should_start_over = false; |
1941 if (clear_all_soft_refs && !*should_compact) { |
1941 if (clear_all_soft_refs && !*should_compact) { |
1942 // We are about to do a last ditch collection attempt |
1942 // We are about to do a last ditch collection attempt |
1943 // so it would normally make sense to do a compaction |
1943 // so it would normally make sense to do a compaction |
1944 // to reclaim as much space as possible. |
1944 // to reclaim as much space as possible. |