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

Print this page
rev 3856 : 8004170: G1: Verbose GC output is not getting flushed to log file using JDK 8
Summary: Add flushes to G1CollectedHeap::log_gc_footer() and TraceCPUTime destructor.
Reviewed-by:

@@ -3688,10 +3688,11 @@
       gclog_or_tty->print("--");
     }
     g1_policy()->print_heap_transition();
     gclog_or_tty->print_cr(", %3.7f secs]", pause_time_sec);
   }
+  gclog_or_tty->flush();
 }
 
 bool
 G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
   assert_at_safepoint(true /* should_be_vm_thread */);

@@ -4034,13 +4035,14 @@
 #ifdef TRACESPINNING
       ParallelTaskTerminator::print_termination_counts();
 #endif
 
       gc_epilogue(false);
+    }
 
+    // Print the remainder of the GC log output.
       log_gc_footer(os::elapsedTime() - pause_start_sec);
-    }
 
     // It is not yet to safe to tell the concurrent mark to
     // start as we have some optional output below. We don't want the
     // output from the concurrent mark thread interfering with this
     // logging output either.