Finding Memory Leaks
If you fix a leak and your program starts crashing, your code is probably trying to use an already-freed object
or memory buffer. To learn more about memory leaks, see Finding Memory Leaks.
You can use the NSZombieEnabled facility to find the code that accesses freed objects. When you turn on
NSZombieEnabled, your application logs accesses to deallocated memory, as shown here:
2008-10-03 18:10:39.933 HelloWorld[1026:20b] *** -[GSFont ascender]: message sent to
deallocated instance 0x126550
To activate the NSZombieEnabled facility in your application:
1. Choose Project > Edit Active Executable to open the executable Info window.
2. Click Arguments.
3. Click the add (+) button in the “ Variables to be set in the environment” section.
4. Enter NSZombieEnabled in the Name column and YES in the Value column.
5. Make sure that the checkmark forthe NSZombieEnabled entry is selected.
, page 55
Also, from Hillegass suggests to set the CFZombieLevel to 16. Cocoa Programming for OSX, 3rd Edition. Page 92