@@ -182,6 +182,8 @@ DefNewGeneration::DefNewGeneration(ReservedSpace rs,
182182 _pretenure_size_threshold_words = PretenureSizeThreshold >> LogHeapWordSize;
183183
184184 _gc_timer = new (ResourceObj::C_HEAP, mtGC) STWGCTimer ();
185+
186+ _gc_tracer = new (ResourceObj::C_HEAP, mtGC) DefNewTracer ();
185187}
186188
187189void DefNewGeneration::compute_space_boundaries (uintx minimum_eden_size,
@@ -531,8 +533,7 @@ void DefNewGeneration::collect(bool full,
531533 SerialHeap* heap = SerialHeap::heap ();
532534
533535 _gc_timer->register_gc_start ();
534- DefNewTracer gc_tracer;
535- gc_tracer.report_gc_start (heap->gc_cause (), _gc_timer->gc_start ());
536+ _gc_tracer->report_gc_start (heap->gc_cause (), _gc_timer->gc_start ());
536537
537538 _old_gen = heap->old_gen ();
538539
@@ -550,7 +551,7 @@ void DefNewGeneration::collect(bool full,
550551
551552 GCTraceTime (Trace, gc, phases) tm (" DefNew" , NULL , heap->gc_cause ());
552553
553- heap->trace_heap_before_gc (&gc_tracer );
554+ heap->trace_heap_before_gc (_gc_tracer );
554555
555556 // These can be shared for all code paths
556557 IsAliveClosure is_alive (this );
@@ -594,8 +595,8 @@ void DefNewGeneration::collect(bool full,
594595 ReferenceProcessorPhaseTimes pt (_gc_timer, rp->max_num_queues ());
595596 SerialGCRefProcProxyTask task (is_alive, keep_alive, evacuate_followers);
596597 const ReferenceProcessorStats& stats = rp->process_discovered_references (task, pt);
597- gc_tracer. report_gc_reference_stats (stats);
598- gc_tracer. report_tenuring_threshold (tenuring_threshold ());
598+ _gc_tracer-> report_gc_reference_stats (stats);
599+ _gc_tracer-> report_tenuring_threshold (tenuring_threshold ());
599600 pt.print_all_references ();
600601
601602 assert (heap->no_allocs_since_save_marks (), " save marks have not been newly set." );
@@ -647,19 +648,19 @@ void DefNewGeneration::collect(bool full,
647648
648649 // Inform the next generation that a promotion failure occurred.
649650 _old_gen->promotion_failure_occurred ();
650- gc_tracer. report_promotion_failed (_promotion_failed_info);
651+ _gc_tracer-> report_promotion_failed (_promotion_failed_info);
651652
652653 // Reset the PromotionFailureALot counters.
653654 NOT_PRODUCT (heap->reset_promotion_should_fail ();)
654655 }
655656 // We should have processed and cleared all the preserved marks.
656657 _preserved_marks_set.reclaim ();
657658
658- heap->trace_heap_after_gc (&gc_tracer );
659+ heap->trace_heap_after_gc (_gc_tracer );
659660
660661 _gc_timer->register_gc_end ();
661662
662- gc_tracer. report_gc_end (_gc_timer->gc_end (), _gc_timer->time_partitions ());
663+ _gc_tracer-> report_gc_end (_gc_timer->gc_end (), _gc_timer->time_partitions ());
663664}
664665
665666void DefNewGeneration::init_assuming_no_promotion_failure () {
0 commit comments