[llvm] 96c4460 - [ARM][MachineOutliner] Fix memory leak.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Tue May 19 11:41:31 PDT 2020


Ah, thanks!

Could it be taken a step further and statically allocated instead of
dynamically allocated?
Replacing:
auto Costs = std::make_unique<OutlinerCosts>(Subtarget);
with:
OutlinerCosts Costs(Subtarget);

?
On Mon, May 18, 2020 at 11:36 PM Yvan Roux <yvan.roux at linaro.org> wrote:

> Hi David,
>
> On Mon, 18 May 2020 at 21:50, David Blaikie <dblaikie at gmail.com> wrote:
>
>> Any chance of using unique_ptr (or non-dynamic allocation), etc, to
>> simplify this memory management?
>>
>
> Yes I replaced it by make_unique shorty after this commit here:
>
> https://github.com/llvm/llvm-project/commit/3648dde3ddd3cc0ba862017d494b7ede6054631c
>
>
> Cheers,
> Yvan
>
>
>>
>> On Fri, May 15, 2020 at 7:27 AM Yvan Roux via llvm-commits <
>> llvm-commits at lists.llvm.org> wrote:
>>
>>>
>>> Author: Yvan Roux
>>> Date: 2020-05-15T16:27:14+02:00
>>> New Revision: 96c4460a0be6f5f66a02eac7fe796e49768001a4
>>>
>>> URL:
>>> https://github.com/llvm/llvm-project/commit/96c4460a0be6f5f66a02eac7fe796e49768001a4
>>> DIFF:
>>> https://github.com/llvm/llvm-project/commit/96c4460a0be6f5f66a02eac7fe796e49768001a4.diff
>>>
>>> LOG: [ARM][MachineOutliner] Fix memory leak.
>>>
>>> Fix sanitizer bots after 0e4827aa4e4ae25813f66d3b872db67d93813009
>>>
>>> Added:
>>>
>>>
>>> Modified:
>>>     llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
>>>
>>> Removed:
>>>
>>>
>>>
>>>
>>> ################################################################################
>>> diff  --git a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
>>> b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
>>> index c160843fcdba..20df55f55bc8 100644
>>> --- a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
>>> +++ b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
>>> @@ -5668,6 +5668,7 @@ outliner::OutlinedFunction
>>> ARMBaseInstrInfo::getOutliningCandidateInfo(
>>>    } else
>>>      return outliner::OutlinedFunction();
>>>
>>> +  delete Costs;
>>>    return outliner::OutlinedFunction(RepeatedSequenceLocs, SequenceSize,
>>>                                      NumBytesToCreateFrame, FrameID);
>>>  }
>>>
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at lists.llvm.org
>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200519/3645227b/attachment.html>


More information about the llvm-commits mailing list