Technical Q&A QA1758

Why is my code acting differently when I debug with Zombies?

Q:  Why is my code acting differently when I debug with Zombies?

A: Enabling the Zombies debugging facility had side effects that changed the behavior of ARC code on some operating systems. Both iOS and OS X apps are effected. This has been fixed in iOS 6 or later and has been fixed in OS X 10.8 or later.

Prior to iOS 6 / OS X 10.8, using the the Zombies instrument or NSZombieEnabled or the "Enable Zombie Objects" Xcode diagnostic, prevented ARC from "cleaning up" instance variables at deallocation-time. Your -dealloc methods would still be run, however any instance variables that you didn't explicitly set to nil would be untouched. If an instance variable strongly referenced an object, then that object would be kept alive forever by the abandoned instance variable.

For this reason, you are strongly encouraged to run your app on an iOS 6+, or OS X 10.8+, system when debugging with Zombies.



Document Revision History


DateNotes
2012-08-06

New document that describes interactions of the Zombie debugging facility with Automatic Reference Counting (ARC) in some versions of iOS and OS X.