Fix a crash with -XX:DumpGCPerformanceOnShutdown.
DumpGcPerformanceInfo() could call RosAllocSpace::InspectAllRosAlloc()
which needs the thread list to be still alive. Fix by moving the
DumpGcPerformanceInfo() call from the Heap destructor up to the
beginning of the Runtime destructor so that the thread list is still
alive when it's called.
Bug: 11830901
Change-Id: Ib094d60916943c8cb1d4b769d805b4ca03269f90
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index 24ee31c..d1784fa 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -78,7 +78,7 @@
double target_utilization, size_t capacity, const std::string& image_file_name,
bool concurrent_gc, size_t parallel_gc_threads, size_t conc_gc_threads,
bool low_memory_mode, size_t long_pause_log_threshold, size_t long_gc_log_threshold,
- bool dump_gc_performance_on_shutdown, bool ignore_max_footprint)
+ bool ignore_max_footprint)
: non_moving_space_(nullptr),
concurrent_gc_(concurrent_gc),
parallel_gc_threads_(parallel_gc_threads),
@@ -86,7 +86,6 @@
low_memory_mode_(low_memory_mode),
long_pause_log_threshold_(long_pause_log_threshold),
long_gc_log_threshold_(long_gc_log_threshold),
- dump_gc_performance_on_shutdown_(dump_gc_performance_on_shutdown),
ignore_max_footprint_(ignore_max_footprint),
have_zygote_space_(false),
soft_reference_queue_(this),
@@ -610,9 +609,6 @@
Heap::~Heap() {
VLOG(heap) << "Starting ~Heap()";
- if (dump_gc_performance_on_shutdown_) {
- DumpGcPerformanceInfo(LOG(INFO));
- }
STLDeleteElements(&garbage_collectors_);
// If we don't reset then the mark stack complains in its destructor.
allocation_stack_->Reset();