Jonathan.
Jonathan.

Reputation: 55554

Low memory warning for NSObject

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

Answers (1)

Vladimir
Vladimir

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

Related Questions