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

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

Question

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.

Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top