在没有池的情况下自动释放
Posted
技术标签:
【中文标题】在没有池的情况下自动释放【英文标题】:autoreleased with no pool in place 【发布时间】:2011-09-08 12:13:06 【问题描述】:当我在 Xcode 4 模拟器中运行我的 iPhone 应用程序时,我得到以下输出,我怎么知道是哪个程序导致了这个?
2011-09-08 15:01:03.807 Mobile[1909:ef03] *** __NSAutoreleaseNoPool(): Object 0x5b08150 of class __NSCFArray autoreleased with no pool in place - just leaking
2011-09-08 15:01:03.808 Mobile[1909:ef03] *** __NSAutoreleaseNoPool(): Object 0x5b05fb0 of class NSCFString autoreleased with no pool in place - just leaking
2011-09-08 15:01:03.809 Mobile[1909:ef03] *** __NSAutoreleaseNoPool(): Object 0x5b05fb0 of class NSCFString autoreleased with no pool in place - just leaking
2011-09-08 15:01:03.810 Mobile[1909:ef03] *** __NSAutoreleaseNoPool(): Object 0x581a730 of class __NSArrayI autoreleased with no pool in place - just leaking
2011-09-08 15:01:03.810 Mobile[1909:ef03] *** __NSAutoreleaseNoPool(): Object 0x5b08300 of class __NSCFSet autoreleased with no pool in place - just leaking
2011-09-08 15:01:03.821 Mobile[1909:ef03] *** __NSAutoreleaseNoPool(): Object 0x5a05930 of class __NSDate autoreleased with no pool in place - just leaking
2011-09-08 15:01:03.824 Mobile[1909:ef03] *** __NSAutoreleaseNoPool(): Object 0x5a06000 of class __NSCFTimer autoreleased with no pool in place - just leaking
2011-09-08 15:01:03.824 Mobile[1909:ef03] *** __NSAutoreleaseNoPool(): Object 0x5b09850 of class __NSDate autoreleased with no pool in place - just leaking
【问题讨论】:
可能重复:How to break on __NSAutoreleaseNoPool. 【参考方案1】:在我之前放置了一些代码时,我在我的 main 函数中发现了问题
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
所以我删除了该代码并放在下面的行之后
【讨论】:
以上是关于在没有池的情况下自动释放的主要内容,如果未能解决你的问题,请参考以下文章
使用 [NSObject load] 初始化没有自动释放池的系统