how to find objects with autorelease message?
My application crashes when the autorelease pool is released. The reason seems to be that the object with autorelease message is sent a release message sometime before the pool is released, hence the application crashes for object which is already released.
Hence I want to find which objects have a pending autorelease message, so that I can balance the retain .. release/aut开发者_StackOverflow中文版orelease messages to that object
if you dont know about 'NSZombieEnabled' you definitely need to check it out - Instructions are here
It won't tell you which objects are in the autoreleasepool but it will tell you which objects are being over-released.
In brief:
1)Double-click an executable in the Executables group of your Xcode project.
2)Click the Arguments tab.
3)In the "Variables to be set in the environment:" section, make a variable called "NSZombieEnabled" and set its value to "YES".
精彩评论