[llvm-commits] [llvm] r97990 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h lib/Analysis/DebugInfo.cpp lib/CodeGen/AsmPrinter/DwarfDebug.cpp lib/CodeGen/AsmPrinter/DwarfDebug.h

Jeffrey Yasskin jyasskin at google.com
Wed Mar 10 22:07:16 PST 2010


On Wed, Mar 10, 2010 at 4:47 PM, Devang Patel <dpatel at apple.com> wrote:
>
> On Mar 10, 2010, at 4:01 PM, Jeffrey Yasskin wrote:
>
>> On Tue, Mar 9, 2010 at 12:22 PM, Devang Patel <dpatel at apple.com> wrote:
>>>
>>> On Mar 9, 2010, at 10:54 AM, Jeffrey Yasskin wrote:
>>>
>>>> Now that nothing uses the result of constructCompileUnit() unless it
>>>> assigns the ModuleCU, can we just bail early when !DIUnit.isMain() and
>>>> avoid new'ing the DIE and CompileUnit?
>>>
>>> With the introduction of DIFile, we are moving away from "isMain" field.
>>>
>>>> Then, if we delete ModuleCU in
>>>> endModule(), this memory leak would go away.
>>>
>>> We should delete ModuleCU. That's an oversight. Please fix it or let me know, I'll do it.
>>
>> I can take it. I assume it's correct to simply not create the
>> CompileUnits and DIEs whose addresses aren't obviously passed
>> anywhere? Or do I need to look out for constructors or other functions
>> that escape their addresses surreptitiously?
>
> Now there is only one compile unit so it is simpler. Regarding other DIEs, it is expected that DIEs are created only if they will be emitted in the output. In other words, unused DIEs are not created. It would good to find and fix leaks in this area.
> -

Here's my patch to delete the ModuleCU at the end of its Module, and
to avoid creating unused CompileUnits and DIEs. I'll commit it
tomorrow morning unless you have comments.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: free_compile_unit.patch
Type: application/octet-stream
Size: 2796 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20100310/9dfb172e/attachment.obj>


More information about the llvm-commits mailing list