NSNotificationCenter and Low-Memory Warnings

When the system is running low on RAM, it issues a low memory warning to the running application. The application responds by freeing up any resources that it does not need at the moment and can easily recreate. View controllers, during a low memory warning, are sent the message didReceiveMemoryWarning.

Objects other than view controllers may have data that they are not using and can recreate later. The BNRImageStore is such an object – when a low-memory warning occurs, it can release its ownership of the images by emptying its dictionary. Then if another object ever asks for a specific image again, that image can be loaded into memory from the filesystem.

In order to have objects that ...

Get iOS Programming: The Big Nerd Ranch Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.