diff options
author | Hiroshi Yamauchi <yamauchi@google.com> | 2013-11-22 16:50:12 -0800 |
---|---|---|
committer | Hiroshi Yamauchi <yamauchi@google.com> | 2013-11-22 16:50:12 -0800 |
commit | 2e899a92439dc6bdaaa67b8230933006284aa600 (patch) | |
tree | c4ecf70d942c258a9c063326c4e318132948f4e8 /runtime/runtime.cc | |
parent | ff3b24aa929a9db79daeef7c0b0522da099700a9 (diff) | |
download | art-2e899a92439dc6bdaaa67b8230933006284aa600.zip art-2e899a92439dc6bdaaa67b8230933006284aa600.tar.gz art-2e899a92439dc6bdaaa67b8230933006284aa600.tar.bz2 |
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
Diffstat (limited to 'runtime/runtime.cc')
-rw-r--r-- | runtime/runtime.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/runtime/runtime.cc b/runtime/runtime.cc index 71ad252..896f7ff 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -109,6 +109,13 @@ Runtime::Runtime() } Runtime::~Runtime() { + if (dump_gc_performance_on_shutdown_) { + // This can't be called from the Heap destructor below because it + // could call RosAlloc::InspectAll() which needs the thread_list + // to be still alive. + heap_->DumpGcPerformanceInfo(LOG(INFO)); + } + Thread* self = Thread::Current(); { MutexLock mu(self, *Locks::runtime_shutdown_lock_); @@ -915,9 +922,10 @@ bool Runtime::Init(const Options& raw_options, bool ignore_unrecognized) { options->low_memory_mode_, options->long_pause_log_threshold_, options->long_gc_log_threshold_, - options->dump_gc_performance_on_shutdown_, options->ignore_max_footprint_); + dump_gc_performance_on_shutdown_ = options->dump_gc_performance_on_shutdown_; + BlockSignals(); InitPlatformSignalHandlers(); |