I am developing an iPhone, objective-c. When we use autorelease, when the object is really freed - when the main pool of auto resources is freed (that is, the application terminates?) Or as soon as the local function ends? For example, I want to do something like this:
- (void) test
{
MyObj * p = [[[[MyObj alloc] init] autorelease];
...
// is p 'released' here?
}
So, "p" is issued as soon as the function exits, or when the autostart pool of this thread is freed? I thought this happens when the local function exits, but I just created my own thread and had to set up an autostart pool, which gives me a second thought about when this actually happens.
thanks
source
share