<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 21, 2016, at 9:05 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Mon, Mar 21, 2016 at 8:44 PM, Pete Cooper via llvm-commits <span dir="ltr" class=""><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank" class="">llvm-commits@lists.llvm.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: pete<br class="">
Date: Mon Mar 21 22:44:32 2016<br class="">
New Revision: 264022<br class="">
<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=264022&view=rev" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project?rev=264022&view=rev</a><br class="">
Log:<br class="">
Use owning pointers instead of raw pointers for Atom's to fix leaks.<br class="">
<br class="">
Currently each File contains an BumpPtrAllocator in which Atom's are<br class="">
allocated.  Some Atom's contain data structures like std::vector which<br class="">
leak as we don't run ~Atom when they are BumpPtrAllocate'd.<br class=""></blockquote><div class=""><br class=""></div><div class="">FWIW, if the only thing allocated in the BumpPtrAllocator is Atoms, you could use a SpecificBumpPtrAllocator, which does run the doors.<br class=""></div></div></div></div></div></blockquote>I think there might be Reference’s in there, but worth investigating doing it this way.  Unfortunately the Window’s bots didn’t like what I did here so i’ve reverted for now.<br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""><br class="">(& if the BumpPtrAllocator doesn't contain only Atoms, you could change it so it does)</div><div class=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br class="">
Now each File actually owns its Atom's using an OwningAtomPtr.  This<br class="">
is analygous to std::unique_ptr and may be replaced by it if possible.<br class=""></blockquote><div class=""><br class="">Yeah, this looks like it could just be a typedef of unique_ptr with a custom deleter that only runs the dtor but doesn't delete, etc.</div></div></div></div></div></blockquote>Just tried this as a quick fix to get the bots to work.  Unfortunately the YAML parser doesn’t like that solution. The problem is that the YAML parser wants to take a reference to a pointer, so i had to make the get() methods be defined as follows to support that.  std::unique_ptr doesn’t return a reference from get() so the YAML parser stops working with them.</div><div><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br class="">
+  T *const &get() const {<br class="">
+    return atom;<br class="">
+  }<br class="">
+<br class="">
+  T *&get() {<br class="">
+    return atom;<br class="">
+  }<br class="">
+</blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br class=""></blockquote></div></div></div></div></blockquote><div><br class=""></div><div>Cheers,</div><div>Pete</div></div></body></html>