[PATCH] LLD: Use std::vector to store SimpleReferences instead of linked list.

Jean-Daniel Dupas mailing at xenonium.com
Tue Mar 10 05:17:22 PDT 2015


My bad, I was thinking about SimpleDefinedAtom allocation and destruction.
Many subclass of SimpleDefinedAtom are allocated using bumpPtrAllocator, (Mach-O, ELF and COFF are all doing this).
In your patch, the vector will be owned by such atoms and its destructor will never be executed.

> Le 10 mars 2015 à 05:55, Rui Ueyama <ruiu at google.com> a écrit :
> 
> Where is the code? Looks like SimpleReference is used only by PE/COFF port.
> 
> On Mon, Mar 9, 2015 at 3:46 PM, Jean-Daniel Dupas <mailing at xenonium.com> wrote:
> SimpleReference was implemented using a vector not so long ago, but that design choice was made because std::vector is not bumpPtrAllocator friendly.
> Mach-O implementation (at least) uses a bumpPtrAllocator to allocate the SimpleReferences. So SimpleReference destructor is never call, and so are members destructor.
> If you use a std::vector, it means you will leak the vector storage memory. As all ilist nodes are allocated using the bumpPtr allocator, we don’t have that issue.
> 
> 
> http://reviews.llvm.org/D8182
> 
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
> 
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits





More information about the llvm-commits mailing list