I am getting this error message in the console:
*** _NSAutoreleaseNoPool(): Object 0x10d2e0 of class NSPathStore2 autoreleased with no pool in place - just leaking
I can't figure out what is the error?
Thanks.
I am getting this error message in the console:
*** _NSAutoreleaseNoPool(): Object 0x10d2e0 of class NSPathStore2 autoreleased with no pool in place - just leaking
I can't figure out what is the error?
Thanks.
Try using the Clang Static Analyzer
It sounds like you've spawned a method onto a new thread (possibly using
+ (void)detachNewThreadSelector:(SEL)aSelector toTarget:(id)aTarget withObject:(id)anArgument;
)Any method that runs on its own thread will need to have an autorelease pool setup up to catch any autoreleased objects:
This is a classic memory management issue, you are autoreleasing some objects without having an autorelease pool in place. Autoreleasing is not a magic. There is an object of type
NSAutoreleasePool
that keeps track of all objects you autorelease and ‘from time to time’ releases them:Each thread has to have its own autorelease pool. That’s quite logical, because threads run ‘at the same time’ and if they shared a common autoreleased pool, it could release an object while you are still working with it.
Now the point. There is a default autorelease pool in the main thread of every application, which means you don’t have to think about all of this and autoreleased objects are collected just fine. But if you create another thread, you are usually forced to also create an autorelease pool for this thread. Otherwise there is nobody to claim the autoreleased objects and they just leak. Which is exactly why you are getting the warning.
Leaking thread without an autorelease pool can look like this:
The fix is simple:
Now you only have to figure out where you are running code in another thread.