<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">std::vector allocates storage to store the list of plain pointer. Its destructor must be call to free that memory.<div class="">That changed was driven by memory leaks analysis tool that reports leaks of memory allocated by std::vector, so this is not some just some arbitrary guess.<div class=""><br class=""><div><blockquote type="cite" class=""><div class="">Le 10 mars 2015 à 20:59, Rui Ueyama <<a href="mailto:ruiu@google.com" class="">ruiu@google.com</a>> a écrit :</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">It seems okay to me if _references vector's destructor is not called. It doesn't own references its pointing to -- it contains a list of plain pointers, not unique_ptr or such. So references will be managed somewhere and that's not changed by this patch.</div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Mar 10, 2015 at 5:17 AM, Jean-Daniel Dupas <span dir="ltr" class=""><<a href="mailto:mailing@xenonium.com" target="_blank" class="">mailing@xenonium.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">My bad, I was thinking about SimpleDefinedAtom allocation and destruction.<br class="">
Many subclass of SimpleDefinedAtom are allocated using bumpPtrAllocator, (Mach-O, ELF and COFF are all doing this).<br class="">
In your patch, the vector will be owned by such atoms and its destructor will never be executed.<br class="">
<br class="">
> Le 10 mars 2015 à 05:55, Rui Ueyama <<a href="mailto:ruiu@google.com" class="">ruiu@google.com</a>> a écrit :<br class="">
<div class=""><div class="h5">><br class="">
> Where is the code? Looks like SimpleReference is used only by PE/COFF port.<br class="">
><br class="">
> On Mon, Mar 9, 2015 at 3:46 PM, Jean-Daniel Dupas <<a href="mailto:mailing@xenonium.com" class="">mailing@xenonium.com</a>> wrote:<br class="">
> SimpleReference was implemented using a vector not so long ago, but that design choice was made because std::vector is not bumpPtrAllocator friendly.<br class="">
> Mach-O implementation (at least) uses a bumpPtrAllocator to allocate the SimpleReferences. So SimpleReference destructor is never call, and so are members destructor.<br class="">
> 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.<br class="">
><br class="">
><br class="">
> <a href="http://reviews.llvm.org/D8182" target="_blank" class="">http://reviews.llvm.org/D8182</a><br class="">
><br class="">
> EMAIL PREFERENCES<br class="">
>   <a href="http://reviews.llvm.org/settings/panel/emailpreferences/" target="_blank" class="">http://reviews.llvm.org/settings/panel/emailpreferences/</a><br class="">
><br class="">
><br class="">
><br class="">
</div></div>> _______________________________________________<br class="">
> llvm-commits mailing list<br class="">
> <a href="mailto:llvm-commits@cs.uiuc.edu" class="">llvm-commits@cs.uiuc.edu</a><br class="">
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank" class="">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br class="">
<br class="">
</blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></div></div></body></html>