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).
Remove references to any temporary objects that you no longer need. If active tasks might consume significant amounts of memory, pause dispatch queues or restrict the number of simultaneous operations that your app performs. Failure to reduce your app's memory usage may result in your app's termination.
onLowMemory() raises when the system global memory is low. If the global memory is okay but your process takes more than 24MB on old Android devices, it will crash and you'll never get a low memory warning.
The two most common solutions to clear storage space on your iPad is to delete photos/videos from your photo library or to uninstall apps. Before you delete anything though, make sure that you know how to backup the files you would like to keep. For example, you can keep a backup of your photo library on iCloud.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With