Why does my iPhone application crash when it receives a memory warning?
This is sort of a mystery to me. My application does not use very much memory but if I put it in the background and run as many memory-intensive applications as I can, occasionally my application will crash when I try to wake it up.
I've looked at the crash log and this is what I see:
0 libobjc.A.dylib 0x000027da objc_msgSend + 18
1 UIKit 0x0008cab4 -[UIViewController unloadViewForced:] + 132
2 UIKit 0x0008ca22 -[UIViewController unloadViewIfReloadable] + 10
3 UIKit 0x0008c9f2 -[UIViewController purgeMemoryForReason:] + 34
4 UIKit 0x0008c896 -[UIViewController didReceiveMemoryWarning] + 10
5 My Application 0x00023340 -[MailboxViewController didReceiveMemoryWarning] (MailboxViewController.m:359)
6 UIKit 0x0008c880 -[UIViewController _didReceiveMemoryWarning:] + 8
As you can I see, my view controller MailboxViewController
gets a didReceiveMemoryWarning
message. Since that view doesn't have anything memory it can free really, I simply make a call to [super didR开发者_StackOverflow中文版eceiveMemoryWarning]
.
The strange thing is that I don't see a call to my view controller's viewDidUnload
. It seems to crash with a "EXC_BAD_ACCESS (SIGSEGV)" before it even gets there.
What is going on and how can I fix it?
I guess it crashed at the time your controller unloading its view, so your viewDidUnload never get called. Is your view just some plain view or complex view? My guess is that it might have something to do with your view.
Try debugging with Zombies enabled--it looks like a message is being sent to a deallocated object.
精彩评论