12

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?

1
  • The Leaks instrument is the best available tool. Did you run leaks both the simulator and on the device?
    – smparkes
    Jan 28, 2012 at 16:09

2 Answers 2

25

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.

1
  • I got "Received memory warning" when debugging my app on an iPhone 5 with tens of other active apps. After I stopped them one by one and tried again, that warning msg was gone. Sep 7, 2016 at 4:20
10

I also found that "Product -> Analyze" (Shift+Command+B) can help you sort out some code issues before you start using Leaks. With the introduction of ARC this became less useful though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.