diff options
author | Greg Clayton <gclayton@apple.com> | 2016-06-07 22:56:40 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2016-06-07 22:56:40 +0000 |
commit | 4a9d83a55e791158371f6babdb44b553e85dbef2 (patch) | |
tree | 6833867ee8160af0d93bf8d5af8963e0c69c520c /lldb/packages/Python/lldbsuite/test/python_api/symbol-context/TestSymbolContext.py | |
parent | cef4360ac42c49a427667dc6b06c50a3a4d7e780 (diff) | |
download | bcm5719-llvm-4a9d83a55e791158371f6babdb44b553e85dbef2.tar.gz bcm5719-llvm-4a9d83a55e791158371f6babdb44b553e85dbef2.zip |
Fix a memory leak in InstructionLLVMC where it held onto a strong reference to the DisassemblerLLVMC which in turn had a vector of InstructionSP causing the strong cycle. This is fixed now.
Rules are as follows for internal code using lldb::DisassemblerSP and lldb::InstructionSP:
1 - The disassembler needs to stay around as long as instructions do as the Instruction subclass now has a weak pointer to the disassembler
2 - The public API has been fixed so that if you get a SBInstruction, it will hold onto a strong reference to the disassembler in a new InstructionImpl class
This will keep code like like:
inst = lldb.target.ReadInstructions(frame.GetPCAddress(), 1).GetInstructionAtIndex(0)
inst.GetMnemonic()
Working as expected (not the SBInstructionList() that was returned by SBTarget.ReadInstructions() is gone, but "inst" has a strong reference inside of it to the disassembler and the instruction.
All code inside the LLDB shared library was verified to correctly hold onto the disassembler instance in all places.
<rdar://problem/24585496>
llvm-svn: 272069
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/python_api/symbol-context/TestSymbolContext.py')
0 files changed, 0 insertions, 0 deletions