[swift-users] Memory management without ARC?

Andrew W. Donoho andrew.donoho at gmail.com
Sat Jan 30 14:36:53 CST 2016


> On Jan 30, 2016, at 12:56 , Matthias Zenger via swift-users <swift-users at swift.org> wrote:
> 
> Nevertheless, this collaborative garbage collection scheme where the mark/sweep collector handles cycles and ARC handles the rest doesn't feel like a good solution. It's, at best, a workaround that is impossible to optimize. This is why I was wondering if there's anything else I could do…



Matthias,



	What you’ve described is essentially the Python memory management system. It is reference counted along with a cycle analyzer. It works quite well. I would not reject it out of hand too soon.

	While the standard answer is to use Swift structures for everything, there are Cocoa structures that work with with weak references. NSPointerFunctionsWeakMemory is one such. There are others, <https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSPointerFunctions_Class/index.html <https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSPointerFunctions_Class/index.html>>.

	I suspect your best answer is to actually build something out of swift collection and sequence primitives.



Anon,
Andrew
____________________________________
Andrew W. Donoho
Donoho Design Group, L.L.C.
andrew.donoho at gmail.com, +1 (512) 666-7596, twitter.com/adonoho

New: Spot marks the taX™ App, <http://SpotMarksTheTaX.com>
Retweever Family: <http://Image.Retweever.com>, <http://Retweever.com>

No risk, no art.
	No art, no reward.
		-- Seth Godin


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160130/df73a5a2/attachment.html>


More information about the swift-users mailing list