<div dir="ltr">-1 for any kind of GC in Swift and any other language/platform.</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 8, 2016 at 6:26 PM, Goffredo Marocchi via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>Devices being able to house a compact amount of RAM is a device vendor concern not a Swift one although the former kind of owns the latter, but that is being a bit cheeky I will admit that ;). </div><div><br></div><div>Still, iPhone 6 Plus only having 1 GB of RAM... Grrrr... :P. Seriously, multitasking suffers greatly on that device as well as having multiple opened tabs on Safari...</div><div><br>Sent from my iPhone</div><div><div class="h5"><div><br>On 8 Feb 2016, at 20:11, Joe Groff via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><br><div><blockquote type="cite"><div>On Feb 8, 2016, at 11:56 AM, Félix Cloutier via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br><div><div style="word-wrap:break-word"><div>Has there been a garbage collection thread so far? I understand that reference counting vs. garbage collection can be a heated debate, but it might be relevant to have it.</div><div><br></div><div>It seems to me that the two principal upsides of reference counting are that destruction is (essentially) deterministic and performance is more easily predicted. However, it comes with many downsides:</div><div><br></div><div><ul><li>object references are expensive to update</li><li>object references cannot be atomically updated</li><li>heap fragmentation</li><li>the closure capture syntax uses up an unreasonable amount of mindshare just because of [weak self]</li></ul></div><div><div><br></div><div>Since Swift doesn&#39;t expose memory management operations outside of `autoreleasepool`, it seems to me that you could just drop in a garbage collector instead of reference counting and it would work (for most purposes).</div></div></div></div></blockquote><br></div><div>While true in theory, code that relies on destructors to clean up unmanaged resources does not port cleanly to GC as-is in practice. GC of course has its own drawbacks. Heap scanning is expensive, thrashing cache and burning battery. GCs also require higher memory ceiling proportional to the amount of heap actively being used, and GCs suitable for interactive use tend to increase responsiveness at the cost of higher memory use, which has its own second-order energy costs—devices need more RAM, and spend more time swapping or killing, and thus need bigger batteries to refresh all that RAM. ARC interoperates better with unmanaged resources, both non-memory resources like sockets and files and also C-level memory resources. The ARC optimizer and Swift&#39;s calling convention also optimize toward reclaiming resources closer to their last use, keeping resource usage low.</div><div><br></div><div>-Joe</div><br></div></blockquote></div></div><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></div><br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div>