【发布时间】:2012-10-18 20:13:59
【问题描述】:
我怀疑何时自动释放对象。当我发现这个question,
在线程接受的答案中,为运行循环执行提供了以下解释:
void int UIApplicationMain (int argc, char *argv[], NSString *principalClassName, NSString *delegateClassName) {
UIApplication *app = /* create app using principalClassName */;
[app setDelegate:/* create delegate using delegateClassName */];
while (![app shouldTerminate]) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
event = [app getNextEvent];
[app dispatchEvent:event];
[pool drain];
}
}
runloop是这样执行的吗?
这是否意味着在每次执行runloop时,都会创建并释放一个新的自动释放池。
【问题讨论】:
标签: objective-c ios nsautoreleasepool nsrunloop