Enable and Debug Zombie Objects in iOS Using Xcode 5.1.1

Enable and Debug Zombie objects in iOS using Xcode 5.1.1

Accessing a deallocated object is not the only reason you would get EXC_BAD_ACCESS. Other causes of bad access errors include accessing nil pointers and going past the bounds of an array.

Looking at your screenshots, you are not using a deallocated object. If you were using a deallocated object, the Zombies template in Instruments would let you know. Instruments would show a message similar to the following:

enter image description here

Your next step should be to set an exception breakpoint in Xcode. When your app crashes, Xcode will pause your app at the point where the crash occurs. To set an exception breakpoint, open the breakpoint navigator by choosing View > Navigators > Show Breakpoint Navigator. Click the + button at the bottom of the navigator and choose Add Exception Breakpoint.

Why do the crash disappear with zombie objects?

The crash is caused by a "dangling pointer" — an object that you send a message to after it has been released.

But with zombies turned on, no objects are ever released. That is why they are called zombies! So there are no dangling pointers; instead, all the objects leak. Leaking doesn't cause a crash, and there are no dangling pointers so the crash goes away.

The point is to give you a chance to understand what object you are sending a message to when the object would have been released if you were not using zombies.

Zombie option missing from both diagnostics and instruments

After digging around some more, I found the answer here: zombie question

Ehud B's answer says you have to use the simulator for iOS apps, not the device. When I switched to the simulator for profiling, the zombies were back.

I should note that Moshe Kravchik's answer indicates that zombies are available in iOS 5. I'm still using iOS 4.

Understanding zombie trace in Instruments

I also have the problem at the beginning of learning Instruments, then I figured out the I have to open the 'Extended detail' Pane to see it.(There might other easy way to enable this, but I did not find yet)

How to find which line of code crashes using Zombie instruments



Related Topics



Leave a reply



Submit