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

StackOverflow https://stackoverflow.com/questions/11623999

My application is ARC enabled one.

In the app delegate i have written a code

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

And my method is

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

I have seen some error messages as given below

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

I fixed this issue by modifying the method as below.

@autoreleasepool
{ 
   NSArray *animationArray = [NSArray arrayWithObjects:
          [UIImage imageNamed:@"1.png"],
          [UIImage imageNamed:@"2.png"],
          [UIImage imageNamed:@"3.png"],
          nil];
}

Can anyone please explain to me, what is happening in this context.

有帮助吗?

解决方案

It says you do not have an autorelease pool to manage autoreleased objects. By default, main thread will have its autorelease pool. When you create a thread you have to create an autorelease pool on your own.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top