I\'m having a problem with some code in the loadView: method of one of my view controllers. Essentially I have a view which centres itself in a larger view (on an iPad) and
Profile your application in the simulator with 'Zombies' Instrument.
Run your app for a while and do whatever you have to do to make your app crash. When it does, you will get a pop up like the image below and it will halt the profiling of the app:
Then if you click on the little arrow next to the address (0x158b3c00) .. it will take you to the object retain/release history for the object that was over released (the zombie).
If you highlight the line above where the retain count went to -1, and open View -> Extended detail, it should point you to the stack trace and line in your code where the object was overreleased:
If you double click the class where it is occuring, it will open up your source and show you the bad line of code:
The over-releasing could be occurring during the objects life time and not just when they're being created. A few tips:
nil
release
/autorelease
. Personally I prefer to have [[[Class alloc] init] autorelease]
all on 1 line.release
/autorelease
. Let's Build NSAutoreleasePool is a good place to start.