iphone - *** __NSAutoreleaseNoPool() : Object 0x926d620 of class NSPathStore2 autoreleased with no pool in place - just leaking

标签 iphone ios automatic-ref-counting nsautoreleasepool

我的应用程序是启用 ARC 的。

在应用程序委托(delegate)中,我编写了一个代码

[self performSelectorInBackground:@selector(initializeAnimationImageArrays) withObject:nil];

我的方法是
- (void)initializeAnimationImageArrays
{
    NSArray *animationArray = [NSArray arrayWithObjects:
           [UIImage imageNamed:@"1.png"],
           [UIImage imageNamed:@"2.png"],
           [UIImage imageNamed:@"3.png"],
           nil];
}

我看到了一些错误消息,如下所示
*** __NSAutoreleaseNoPool(): Object 0x926d620 of class NSPathStore2 autoreleased with no pool in place - just leaking
我通过修改如下方法解决了这个问题。
@autoreleasepool
{ 
   NSArray *animationArray = [NSArray arrayWithObjects:
          [UIImage imageNamed:@"1.png"],
          [UIImage imageNamed:@"2.png"],
          [UIImage imageNamed:@"3.png"],
          nil];
}

谁能向我解释一下,在这种情况下发生了什么。

最佳答案

它说您没有自动释放池来管理自动释放的对象。
默认情况下,主线程将拥有其自动释放池。
当你创建一个线程时,你必须自己创建一个自动释放池。

关于iphone - *** __NSAutoreleaseNoPool() : Object 0x926d620 of class NSPathStore2 autoreleased with no pool in place - just leaking,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11623999/

相关文章:

ios - 使用 Instruments 减少来自相机的 UIImages 的内存

javascript - jquery.cycle 和 touchslider.js 一起工作?

iphone - iOS UITabBar : Remove top shadow gradient line

javascript - 为什么移动 safari 似乎会给出与桌面浏览器不同的 Javascript Date() 结果?

ios - 如何为标识符使用 PerformSegue

objective-c - 在 ARC ObjectiveC++ 中使用 C++11 lambda 函数——如何正确使用?

ios - 急救员不变

ios - 如何保存和重用整数

ios - 自定义 Google 登录按钮 - iOS

objective-c - 以编程方式从 ARC 中的导航堆栈中删除 viewController