Reputation: 55554
I have a subclass of NSObject, it is a singleton which loads a list of images into memory, either from hard drive or downloads them from the internet.
I want to release the images stored in memory if the app recieves a low memory message, like in a UIViewController. (it then gets the images from hard drive when it next needs them).
Upvotes: 5
Views: 2997
Reputation: 170839
You can implement -applicationDidReceiveMemoryWarning:
method in your application delegate and free memory there. Or you can make your singleton object listen to UIApplicationDidReceiveMemoryWarningNotification
notification and free memory in notification handler.
Upvotes: 10