3 ms·
> autoreleased objects will typically stick > around until the end of the event loop cycle They stick around until their reference count drops to zero. The -
by mpweiher 10y ago
> autoreleased objects will typically stick
> around until the end of the event loop cycle
They stick around until their reference count drops to zero. The -autorelease is turned into a -release when the containing autorelease pool is released, so you have full control over when that happens.
@autoreleasepool {
[[[NSObject alloc] init] autorelease];
}
The object is freed at the end of that block.
Yes, there is a default autorelease pool for the event loop.
- pavlov 10y agoI know. That's why I wrote "typically".