Monday, 16 August 2010

NSZombies to the rescue... finding your EXC BAD ACCESS memory issue

Anyone who has developed a native application for iOS will have encountered the dreaded EXC BAD ACCESS error with zero information about what caused the crash.

NSZombies catches attempts to access deallocated objects (which are the primary causes of that error) by replacing the deallocated object with a zombie.

When a zombie is accessed a helpful message is logged to the console: message sent to deallocated instance

Take a read of Finding Memory Leaks for instructions on how to activate NSZombieEnabled on your Debug executable.

Make sure you only activate NSZombies on your Debug executable as you don't want to release an application that never frees memory.

No comments:

Post a Comment