简体   繁体   中英

What amount of memory should I target for my iOS app?

I am currently showing that my app is using a maximum of 200MB when it is running. Is there a way to tell if this is going to trigger a low memory warning? So far I have not had any issues with the simulator or actuall devices.

We must avoid spiking the memory. For example loading images from disk or cache in loop. This will create a memory spike and it is at this point iOS starts to throw low memory warnings. The exact amount of memory is not specified by Apple. In many applications I have observed that as the memory grows gradually iOS is comfortable and app works properly. But if memory spike occurs low memory warning is thrown.

Apps can use 200 MB of memory these days easily, how ever it is important to simulate and handle low memory warnings in order to be on the safe side.

If you want to trigger low memory warning using simulator, there is a option of doing so in the Menu->Debug of Simulator (Cmd+Shift+M). In device you may load some big images in a for loop. You may also call a private method. [[UIApplication sharedApplication] performSelector:@selector(_performMemoryWarning)]; Just be sure that this code does not go to production as Apple will reject the binary as private method is being used.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM