I'd like to test my app functions well in low memory conditions, but it's difficult to test. How can I induce low memory warnings that trigger the didReceiveMemoryWarning method in my views when the app is running on the device, not the simulator? Or what are some ways I can test my app under these possible conditions?
The reason I can't use the simulator is my app uses Game Center and invites don't work on the simulator.
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.
There are various ways to identify low memory warnings.To simulate the memory warning we need to enable the toggle when the app runs on the simulator. To enable the logger for memory warnings, please run the app onto the simulator and then go to Debug → Simulate Memory Warning.
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.
Go to Settings > General and go through your apps that have the most data. If your streaming or other apps occupy a couple of gigs and you don't have anything downloaded on those services, uninstall the apps and reinstall them. This will clear out the cache.
You can call the private method:
[[UIApplication sharedApplication] performSelector:@selector(_performMemoryWarning)];
Just remember to use it on debug only, or else your app will get rejected.
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