Observing Low-Memory Warnings
Even if you’ve done everything correctly, in a large application you may simply run out of memory. When that situation occurs, the system dispatches a low-memory notification to your application — and it’s something you must pay attention to. If you don’t, it’s a reliable recipe for disaster. (Think of your low-fuel light going on as you approach a sign on the highway that says, “Next services 100 miles.”)
UIKit provides several ways for you to set up your application so that you receive timely low-memory notifications:
didReceiveMemoryWarning methods in your custom
applicationDidReceiveMemoryWarning: method of your application delegate.
Register to receive the
UIApplicationDidReceiveMemoryWarning Notification: notification.
The viewDidUnload method
When a low-memory condition occurs, one way to free some memory is to remove views that aren’t being used. You don’t have to worry about that, however, because it’s handled in the view controller class from which you derive your view controllers —
What you do have to worry about, though, is managing any references to ...