根据stackoverflow上面的大婶的回答:http://stackoverflow.com/questions/6475727/why-does-static-nsstring-leak
This message shows up when you autorelease an object on a thread that does not have any release pools in its stack. By default, there is always an autorelease pool on the main thread. It's created and managed within the UIApplicationMain()
function that is usually called by your app's main() function. However, additional threads you create (with performSelectorInBackground:
orNSThread
) do not have an autorelease pool in place unless you specifically put one there, so any autoreleased objects on that background thread have no pool to release them later, and will just leak.
If you're kicking something off to a background thread, the first thing you should do is create an autorelease pool. Under ARC, use the new @autoreleasepool
construct to do that.