In my iOS 5 project with ARC enabled, one of my objects gets released prematurely, so when I try to get to it later I get a null pointer. Before ARC, I would have simply overridden release
like this:
-(oneway void)release {
NSLog(@"-1"); //breakpoint goes here
[super release];
}
then added a breakpoint on the NSLog and inspected the call stack to see who is causing a release.
How do I find out who "called" release under ARC? ("Called" might be the wrong word since the compiler inserts the release calls, so what I mean is "where is the line that the compiler inserted a release call?").
If you need to see where retains, releases and autoreleases occur for an object use instruments:
Run in instruments, in Allocations set "Record reference counts" on (you have to stop recording to set the option). Cause the problem code to run, stop recording, search for the ivar of interest, drill down and you will be able to see where all retains, releases and autoreleases occurred.
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