I am trying to harden my code to avoid low-memory crashes. I'm stuck on one in particular, which occurs according to these steps:
Via NSLog statements everywhere, I see that the initial (presenting) viewcontroller receives a memory warning, then its dealloc method is called over and over until a crash. For purposes of debugging, I have nothing in my didReceiveMemoryWarning, viewDidUnload, or dealloc methods except the NSLog statements.
What does this sound like? Maybe I have some retained instance variable which has a pointer back to the view controller? I just need a general guess of what could be causing this. Can't post my entire view controller code which runs into the 1000's of lines.
Thanks.
You indicated in your latest comment that you think you fixed a case of over-releasing the view controller, but I'm not so sure about that. Over-releasing the view controller will still cause dealloc
only to be called once.
A much more likely cause of "dealloc method called over and over until a crash" is calling [self dealloc];
in your dealloc
method, rather than the appropriate [super dealloc];
. Check that your code is correct in this respect, there may be infinite recursion causing you issues. :)