< prev index next >

src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp

Print this page
rev 7211 : 8058568: GC cleanup phase can cause G1 skipping a System.gc()
Summary: Marking G1 FullGC as a _full collection and passing down the correct before count.
Reviewed-by:

@@ -2480,20 +2480,22 @@
 void G1CollectedHeap::collect(GCCause::Cause cause) {
   assert_heap_not_locked();
 
   unsigned int gc_count_before;
   unsigned int old_marking_count_before;
+  unsigned int full_gc_count_before;
   bool retry_gc;
 
   do {
     retry_gc = false;
 
     {
       MutexLocker ml(Heap_lock);
 
       // Read the GC count while holding the Heap_lock
       gc_count_before = total_collections();
+      full_gc_count_before = total_full_collections();
       old_marking_count_before = _old_marking_cycles_started;
     }
 
     if (should_do_concurrent_full_gc(cause)) {
       // Schedule an initial-mark evacuation pause that will start a

@@ -2534,11 +2536,11 @@
                                    g1_policy()->max_pause_time_ms(),
                                    cause);
         VMThread::execute(&op);
       } else {
         // Schedule a Full GC.
-        VM_G1CollectFull op(gc_count_before, old_marking_count_before, cause);
+        VM_G1CollectFull op(gc_count_before, full_gc_count_before, cause);
         VMThread::execute(&op);
       }
     }
   } while (retry_gc);
 }
< prev index next >