在XCode 4.2中,有两种方法来打开NSZombie。

方法一,添加环境变量, 在菜单中,选择Product->Edit Schema, 选择Run (App Name), 在Arguments下面的Environment Variables中,添加NSZombieEnabled, Value值为YES。

方法二,打开Diagnostics, 同样在菜单中选择Product -> Edit Schema, 选择Run (App Name), 在Diagnostics下,打开Memory Management下的Enable Zombie Objects.

 
同时可以添加MallocStackLogging来启动malloc纪录。