iOS - i receive memory warnings but have no idea why

Erik Sapir picture Erik Sapir · Jan 28, 2012 · Viewed 34.3k times · Source

I am developing for the iOS and checking my app with IPhone and IPad.

I receive many memory warnings (didReceiveMemoryWarning is called) but have no idea why. My app is using ~35MB in the peak points, and 4-5 MB when it the lowest point.

I tried to find leaks using 'instruments' but could not find any critical issues.

Is there a good way to find out why the system sends memory warnings?

Answer

X Slash picture X Slash · Jan 28, 2012

Memory warning is to be expected in an iOS app. It doesn't have to be because of your app. Other apps are still in memory even if the apps are suspended. The OS will do memory management by sending memory warning and kill apps when necessary. As long as you're using reasonable amount of memory (with little to no memory leak) and handle didReceiveMemoryWarning properly, you'll be fine.

Also, when your app is in suspended mode, if your app is using little memory footprint, your app will more likely to survive killing process. As app with larger memory footprint will be terminated first.