UIApplication Loop 中的 AutoreleasePool
我有一个以 iPhone 应用程序的默认代码开头的应用程序:
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
因为我的应用程序永远不会停止,所以永远不会调用 [pool release]
。 UIApplicationMain
的标准 UI 循环是否有一个自己的 AutoreleasePool
,它会破坏我的应用期刊的自动释放对象?或者我是否必须在我的代码的某个点上自行负责使用一个新的 AutoreleasePool ,这是定期调用的,以确保我的应用程序在无限运行时避免内存泄漏?
i have an app that starts with the default code for iPhone Apps:
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
Cause my app never stopps, the [pool release]
is never called. Has the standard UI loop of UIApplicationMain
an own AutoreleasePool
which destroys the autoreleased objects of my app periodical? Or did i have to use a new AutoreleasePool
on my own responsibility at a point of my code, which is periodical called to keep my app clean of memory leaks when it runs endless?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请参阅“main.m 真的是每个事件创建主运行循环的自动释放池的地方吗?”
See "is the main.m really the place, where the autorelease pool of the main run loop is created by every event?"