From 3c4a43469046934e76082a4cf1aca14429cd9735 Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Wed, 23 Apr 2014 14:41:11 -0700 Subject: Don't allow heap transitions if the runtime is shutting down. Bug: 14254222 Change-Id: I97ac988a96b56a8dc1eec018bf3ef7a691f04745 --- runtime/gc/heap.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'runtime/gc') diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc index 502da12..517c748 100644 --- a/runtime/gc/heap.cc +++ b/runtime/gc/heap.cc @@ -1432,6 +1432,11 @@ void Heap::TransitionCollector(CollectorType collector_type) { if (collector_type == collector_type_) { return; } + if (Runtime::Current()->IsShuttingDown(self)) { + // Don't allow heap transitions to happen if the runtime is shutting down since these can + // cause objects to get finalized. + return; + } // GC can be disabled if someone has a used GetPrimitiveArrayCritical but not yet released. if (!copying_transition || disable_moving_gc_count_ == 0) { // TODO: Not hard code in semi-space collector? -- cgit v1.1