<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 4 February 2014 14:27, Manu <span dir="ltr"><<a href="mailto:turkeyman@gmail.com" target="_blank">turkeyman@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 4 February 2014 14:19, Michel Fortin <span dir="ltr"><<a href="mailto:michel.fortin@michelf.ca" target="_blank">michel.fortin@michelf.ca</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>On 2014-02-04 03:45:33 +0000, Manu <<a href="mailto:turkeyman@gmail.com" target="_blank">turkeyman@gmail.com</a>> said:<br>


<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The majority of trivial allocations don't produce cycles; closures,<br>
strings, temporary arrays and working sets.<br>
</blockquote>
<br></div>
Oh, no. Beware of closures. That's a frequent problem in Objective-C ARC, even for those who understand ARC well. You have to be very careful of closures creating cycles if you use them as callbacks. For instance, you have a view that has a pointer to the model and sets a callback for the model to call when something change to update the view; that's a cycle and you need to use a weak ref to the view within the closure. Pretty common pattern.</blockquote>

<div><br></div><div>Ah right. Interesting.</div><div>It sounds like this could be addressed easily though by the API that manages the 'event' handler. If you use a raw delegate, maybe it's a problem, but it sounds like an event-programming construct, and that usually requires an event class that can handle multiple subscribers, as soon as that exists, it's easy to hide the weak reference behind the event api...</div>

</div></div></div>
</blockquote></div><br></div><div class="gmail_extra">I can say that all the closures that I've observed in my D apps so far have been entirely trivial.</div></div>