[swift-evolution] What about garbage collection?

Austin Zheng austinzheng at gmail.com
Mon Feb 8 14:35:08 CST 2016


(Sorry, Felix; I screwed up my original email and didn't send it to the
list.)

Having the option of a GC would be interesting, but one consideration among
many: how would it work with the COW value type collections? It seems those
would rule out a tracing garbage collector in practice, and the only 'real'
option would be RC + a cycle detector?

On Mon, Feb 8, 2016 at 11:56 AM, Félix Cloutier <swift-evolution at swift.org>
wrote:

> 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.
>
> 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:
>
>
>    - object references are expensive to update
>    - object references cannot be atomically updated
>    - heap fragmentation
>    - the closure capture syntax uses up an unreasonable amount of
>    mindshare just because of [weak self]
>
>
> Since Swift doesn'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).
>
> Has a GC been considered at all?
>
> Félix
>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160208/4f34533d/attachment.html>


More information about the swift-evolution mailing list