3 ms·
It doesn't seem so to me. AFAIK deleteLater and autorelease pools are a way of postponing cleanup until sometime after execution returns to the message loop.
by blub 10y ago
It doesn't seem so to me.
AFAIK deleteLater and autorelease pools are a way of postponing cleanup until sometime after execution returns to the message loop.
That's not useable for implementing something like a graph class.
- mpweiher 10y agoDon't know about deleteLater, but autorelease is simply scoped to the enclosing autorelease pool. So @autorelease { [NSMutableArray array]; } ---> the array disappears here More precisely, the array gets an additional release at that point, so if someone else has retained it, it will stick around. The part about the message-loop is also true: by default, the AppKit creates a pool when it runs the message loop -messageLoop { @autorelease { handle one iteration of the loop } } So that's the default behaviour you get if you don't do anything else, but you can go as fine in terms of granularity as you want (and the overhead of doing that is pretty minimal and has gotten less with time).
- mhogomchungu 10y ago> That's not useable for implementing something like a graph class. How about Qt's management of QObjects through QObject's parent/child relationship?[1] [1] http://doc.qt.io/qt-4.8/objecttrees.html http://doc.qt.io/qt-4.8/objecttrees.html
- blub 10y agoThat's perfect for trees :)