[cfe-dev] [RFC] Clearing Clang AST before running backend optimizations/codegen to save memory

David Blaikie via cfe-dev cfe-dev at lists.llvm.org
Tue Sep 21 16:21:50 PDT 2021


On Tue, Sep 21, 2021 at 4:11 PM Arthur Eubanks <aeubanks at google.com> wrote:

> I haven't looked too much into the -disable-free stuff, but the reason it
>>> mitigates crashes is because if we clear AST objects we still have dangling
>>> references to them that we later attempt to clean up unless we
>>> -disable-free.
>>>
>>
>> So disabling free is keeping more things alive - perhaps then the RAM
>> savings aren't as much as they could be if freeing was enabled? But yeah,
>> more to look into.
>>
> -disable-free only disables freeing things right before we exit to save
> some runtime during teardown (since the kernel freeing things is probably
> faster than the userspace allocator freeing things), so it shouldn't affect
> the amount of memory savings we get.
>

Right right, fair enough. (still worries me a bit - reflects that we might
be creating a less-than-library-usable code change, which would be best
avoided given all the interesting uses of clang as a library)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20210921/50964660/attachment.html>


More information about the cfe-dev mailing list