Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Memory used by any iPhone app

There are a few things that I don't understand about iOS memory management.

  1. I wanted to know how much memory typically an iPhone app takes while running on device (Is there any fix number like 10MB?)

  2. If an app includes lot of large images what is the impact on the memory? Do they only impact memory when they are loaded?

  3. How does iOS manage the memory when there are multiple apps running?

Please help me understand these concepts.

like image 829
Abhinav Avatar asked Nov 12 '10 18:11

Abhinav


2 Answers

There isn't a stated or fixed amount of memory available to apps on iOS devices.

That said, there are game apps that are reported to use over 55MB of memory, however the OS is also reported to kill these games some significant percentage of the time if not run right after a device reset.

If you use 22MB of memory or less, the OS could still kill your app because there wasn't enough available memory, but it would also have to kill a massive percentage of other apps in the app store, so you would be in very good company.

When any app (foreground or background) requests enough memory to start depleting the memory pool sufficiently, memory warnings are sent to other apps. If the memory pool gets small enough, apps are killed, including possibly the foreground app if it's a big memory hog.

like image 170
hotpaw2 Avatar answered Oct 20 '22 10:10

hotpaw2


Q1) There isn't a fixed value, of course. Every application (and application instance) will use a different amount of memory depending on it's task(s). There is a maximum, however. Reaching this maximum will trigger a memory warning and the OS may kill it.

Q2) Images: Depends on how many you are showing at once, or through animations.

Q3) The application in the foreground gets the most memory allocated to it. Applications in the background can request memory to perform background tasks.

Good article for best practices:

http://inessential.com/2010/06/28/how_i_manage_memory

like image 30
Evan Mulawski Avatar answered Oct 20 '22 09:10

Evan Mulawski