The search for Zombies (NSZombies)

Debugging (auto)release errors

It’s quite easy to release an object twice, causing Objective-C programs to crash somewhere else. Quite difficult to detect, therefore create the following .gdbinit file in your home folder:

fb -[NSException raise]
fb objc_exception_throw()
fb -[_NSZombie release]
fb szone_error

It will trigger the debugger with some very handy breakpoints. Now add a variable to the startup enviroment in Xcode. Double click on MacTrek under executables. Set the following var:

NSZombie=YES

Don’t forget to remove when ready, it’s quite a memory/performance hog.

Advertisements
Tagged with:
Posted in Code

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories
%d bloggers like this: