質問

I am nearing completion on my first app and I'm suddenly seeing that the app is causing memory leaks. I have found a few leaks and fixed them. Now there are no leaks but to my surprise when NSZombie is enabled it is showing more than 4000 leaks which are mainly from frameworks.

I am confused with the exact use of NSZombie. Is it only used for finding the zombies or is it in any way useful for finding leaks?

Here is a screenshot that shows all the leaks which are associated with the frameworks:

Screenshot for leaks

役に立ちましたか?

解決

I believe the command line option 'NSDeallocateZombies' defaults to NO. So zombies are never deallocated and thus appear as leaks if zombies (NSZombiesEnabled) are on. Never test for leaks with zombies on. You can turn NSDeallocateZombies to YES as well but I'm not sure how that interacts with Instruments. A zombie is a special object that responds to all messages with an exception. In order to make this useful it has to live a long time (so you can catch when you try to reuse a deallocated object) but that makes it look exactly like a leak.

他のヒント

if NSZombie is enable a "release" do not free the memory. NSZombie is used for test if you use a object already released

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top