<div dir="ltr">On 9 October 2013 23:06, Michel Fortin <span dir="ltr"><<a href="mailto:michel.fortin@michelf.ca" target="_blank">michel.fortin@michelf.ca</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 2013-10-09 07:33:29 +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">
Is there more to it? Cleaning up circular references I guess... what does<br>
Apple do?<br>
</blockquote>
<br>
Apple implemented auto-nulling weak pointers for ARC (as well as __unsafe_unretained ones if you are not afraid of dangling pointers).<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
It's an uncommon edge case, so there's gotta be heaps of room for efficient<br>
solutions to that (afaik) one edge case. Are there others?<br>
</blockquote>
<br>
I don't know about you, but circular references are not rare at all in my code.<br>
<br>
Another solution that could be used for circular references is to have the stop-the-world GC we have now collect them. Reference counting could be used to free GC memory in advance (in the absence of circular references), so the GC would have less garbage to collect when it runs.<br>

<br>
Both solutions (week-autonulling and last-resort GC) are not mutually exclusive and can coexist.</blockquote><div><br></div><div>I suspect there are plenty of creative possibilities that could be applied to reducing the pool of potential circular-references to as small a pool as possible.</div>
<div>It's simply not feasible to have machine scanning 4-6 gigabytes of allocated memory looking for garbage.</div></div></div></div>