This is ONLY regarding the new Xcode 4.1, specifically running on Lion. How do you enable NSZombie in Instruments ? It is no longer in Allocations in the (i) icon under Launch Configuration as in Xcode 4.0. Nor is there a Library entry called Zombies.
Of course the problem is I cannot fall back to Xcode 4.0 because it refuses to run under Lion, so I'm in a pickle ! Any other bleeding edge developers using Lion who, with more experience than myself, can help dig this out ? Thanks. -Ric
I got this very useful answer from Apple regarding my own question. It is verbatim -
ME: Is there an update as to how to find those tough deallocated objects, testing on the device, using Xcode 4.1.1 and/or Instruments ?
APPLE: First up, the hack shown above [in Apple's Forum] has been obsoleted by internal changes to the OS, namely, Zombie setup is now done by CF. You can force zombies enabled using the code shown below:
extern void _CFEnableZombies(void);
int main(int argc, char **argv) { _CFEnableZombies();
... rest of your main ...
}
IMPORTANT: The _CFEnableZombies function is private, so you don't even think about putting this code into a production app. However, it's not secret; you can see how it's implemented by looking in the Darwin open source for Lion.
http://www.opensource.apple.com/source/CF/CF-635/CFRuntime.c
If you do this, your app will stop (with a breakpoint exception) when you message a zombie, regardless of how you run it. So you can run it in Instruments with the Allocations instrument and get both zombie detection and allocation tracking.
Note that when a zombie is messaged the system prints something like this:
*** -[ ]: message sent to deallocated instance "
This doesn't appear in the Instruments console area; you'll have to use the Xcode Organizer (or iPCU) to view it.
Share and Enjoy
Quinn "The Eskimo!" Apple Developer Relations, Developer Technical Support, Core OS/Hardware
ME: hope that is useful info for some of you in this situation.
It's a distinct instrument:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With