From 56d404281f8f94dd2d1915b91111e8db8e90e857 Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Wed, 31 Jul 2013 02:19:15 +0000 Subject: The DisassemblerLLVMC has a retain cycle - the InstructionLLVMC's contained in its instruction list have a shared pointer back to their DisassemblerLLVMC. This checkin force clears the InstructionList in all the places we use the DisassemblerSP to stop the leaking for now. I'll go back and fix this for real when I have time to do so. llvm-svn: 187473 --- lldb/source/Target/ThreadPlanStepRange.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lldb/source/Target/ThreadPlanStepRange.cpp') diff --git a/lldb/source/Target/ThreadPlanStepRange.cpp b/lldb/source/Target/ThreadPlanStepRange.cpp index e2820790e71..da25348c2dd 100644 --- a/lldb/source/Target/ThreadPlanStepRange.cpp +++ b/lldb/source/Target/ThreadPlanStepRange.cpp @@ -66,6 +66,16 @@ ThreadPlanStepRange::ThreadPlanStepRange (ThreadPlanKind kind, ThreadPlanStepRange::~ThreadPlanStepRange () { ClearNextBranchBreakpoint(); + + size_t num_instruction_ranges = m_instruction_ranges.size(); + + // FIXME: The DisassemblerLLVMC has a reference cycle and won't go away if it has any active instructions. + // I'll fix that but for now, just clear the list and it will go away nicely. + for (size_t i = 0; i < num_instruction_ranges; i++) + { + if (m_instruction_ranges[i]) + m_instruction_ranges[i]->GetInstructionList().Clear(); + } } void @@ -99,6 +109,9 @@ ThreadPlanStepRange::AddRange(const AddressRange &new_range) // condense the ranges if they overlap, though I don't think it is likely // to be very important. m_address_ranges.push_back (new_range); + + // Fill the slot for this address range with an empty DisassemblerSP in the instruction ranges. I want the + // indices to match, but I don't want to do the work to disassemble this range if I don't step into it. m_instruction_ranges.push_back (DisassemblerSP()); } -- cgit v1.2.3