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.
<rdar://problem/14581918>
llvm-svn: 187473
diff --git a/lldb/source/Core/Disassembler.cpp b/lldb/source/Core/Disassembler.cpp
index fd0cae6..e80e92c 100644
--- a/lldb/source/Core/Disassembler.cpp
+++ b/lldb/source/Core/Disassembler.cpp
@@ -316,14 +316,19 @@
if (bytes_disassembled == 0)
return false;
- return PrintInstructions (disasm_sp.get(),
- debugger,
- arch,
- exe_ctx,
- num_instructions,
- num_mixed_context_lines,
- options,
- strm);
+ bool result = PrintInstructions (disasm_sp.get(),
+ debugger,
+ arch,
+ exe_ctx,
+ num_instructions,
+ num_mixed_context_lines,
+ options,
+ strm);
+
+ // 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.
+ disasm_sp->GetInstructionList().Clear();
+ return result;
}
}
return false;
@@ -361,14 +366,19 @@
prefer_file_cache);
if (bytes_disassembled == 0)
return false;
- return PrintInstructions (disasm_sp.get(),
- debugger,
- arch,
- exe_ctx,
- num_instructions,
- num_mixed_context_lines,
- options,
- strm);
+ bool result = PrintInstructions (disasm_sp.get(),
+ debugger,
+ arch,
+ exe_ctx,
+ num_instructions,
+ num_mixed_context_lines,
+ options,
+ strm);
+
+ // 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.
+ disasm_sp->GetInstructionList().Clear();
+ return result;
}
}
return false;