From 68d4c069f2920897cad2870a2257ed7af3c1db96 Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Tue, 23 Feb 2016 10:37:32 -0800 Subject: [PATCH] Fix allocation tracking race Need to instrument the stubs before calling Heap::SetAlloctrackingEnabled or else we can get this DCHECK failing DCHECK(!IsAllocTrackingEnabled()) Bug: 27506909 (cherry picked from commit 16e51beb9a771ffe7be833173e3dd5f2dac63892) Change-Id: I45d6f716ed55371d41e7b7673209166401dbc62e --- runtime/gc/allocation_record.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/runtime/gc/allocation_record.cc b/runtime/gc/allocation_record.cc index 83e5bad55..4de5388d8 100644 --- a/runtime/gc/allocation_record.cc +++ b/runtime/gc/allocation_record.cc @@ -238,9 +238,12 @@ void AllocRecordObjectMap::SetAllocTrackingEnabled(bool enable) { << records->max_stack_depth_ << " frames, taking up to " << PrettySize(sz * records->alloc_record_max_) << ")"; heap->SetAllocationRecords(records); - heap->SetAllocTrackingEnabled(true); } Runtime::Current()->GetInstrumentation()->InstrumentQuickAllocEntryPoints(); + { + MutexLock mu(self, *Locks::alloc_tracker_lock_); + heap->SetAllocTrackingEnabled(true); + } } else { { MutexLock mu(self, *Locks::alloc_tracker_lock_); -- 2.11.0