1.1 --- a/src/share/vm/memory/defNewGeneration.cpp Sat Oct 23 23:03:49 2010 -0700 1.2 +++ b/src/share/vm/memory/defNewGeneration.cpp Thu Oct 28 14:46:29 2010 -0700 1.3 @@ -809,13 +809,16 @@ 1.4 } 1.5 1.6 void DefNewGeneration::gc_epilogue(bool full) { 1.7 + DEBUG_ONLY(static bool seen_incremental_collection_failed = false;) 1.8 + 1.9 + assert(!GC_locker::is_active(), "We should not be executing here"); 1.10 // Check if the heap is approaching full after a collection has 1.11 // been done. Generally the young generation is empty at 1.12 // a minimum at the end of a collection. If it is not, then 1.13 // the heap is approaching full. 1.14 GenCollectedHeap* gch = GenCollectedHeap::heap(); 1.15 if (full) { 1.16 - assert(!GC_locker::is_active(), "We should not be executing here"); 1.17 + DEBUG_ONLY(seen_incremental_collection_failed = false;) 1.18 if (!collection_attempt_is_safe()) { 1.19 gch->set_incremental_collection_failed(); // Slight lie: a full gc left us in that state 1.20 set_should_allocate_from_space(); // we seem to be running out of space 1.21 @@ -824,7 +827,21 @@ 1.22 clear_should_allocate_from_space(); // if set 1.23 } 1.24 } else { 1.25 - assert(!gch->incremental_collection_failed(), "Error"); 1.26 +#ifdef ASSERT 1.27 + // It is possible that incremental_collection_failed() == true 1.28 + // here, because an attempted scavenge did not succeed. The policy 1.29 + // is normally expected to cause a full collection which should 1.30 + // clear that condition, so we should not be here twice in a row 1.31 + // with incremental_collection_failed() == true without having done 1.32 + // a full collection in between. 1.33 + if (!seen_incremental_collection_failed && 1.34 + gch->incremental_collection_failed()) { 1.35 + seen_incremental_collection_failed = true; 1.36 + } else if (seen_incremental_collection_failed) { 1.37 + assert(!gch->incremental_collection_failed(), "Twice in a row"); 1.38 + seen_incremental_collection_failed = false; 1.39 + } 1.40 +#endif // ASSERT 1.41 } 1.42 1.43 if (ZapUnusedHeapArea) {