3 ms·
Don't know about deleteLater, but autorelease is simply scoped to the enclosing autorelease pool. So @autorelease { [NSMutableArray array]; }
by mpweiher 10y ago
Don'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).