Friday, October 30, 2009

The iPhone has just 58 MB of RAM

I went to Apple's iPhone Developer Event in San Jose yesterday. The best talk, in my opinion, was "Maximizing iPhone Application Performance" by Michael Jurewitz. App performance is something I really care about.

Here's the most shocking fact from the presentation: the iPhone only has 58 MB of RAM for your application

The original and the 3G iPhones only have 128 MB of RAM. The first two generations of iPods also have 128 MB. Together, these devices make up 62% of reMail's userbase, so it's good practice to design with their restrictions in mind.

The iPhone has virtual memory for memory mapping, but it has no swap file. The 128 MB is all you have to work with. Once that runs out, you get memory warnings, and then your application gets shut down. Bye-bye!

Out of the 128 MB, 70 MB are in use by the system at any given time. So only 58 MB are available for your application to work with.

iPhone RAM usage

Here's how it breaks down:
  • 12 MB are immediately reserved for Graphics
  • 32 MB are wired for use by the Kernel
  • 12 MB are Various Daemons, e.g. SMS, mediaserverd, etc.
  • 10 MB for SpringBoard (this is essentially the app launcher and UI manager)
  • 4 MB for Phone process (receiving calls)
58 MB is not a whole lot. Better be memory efficient!

1 comment:

CampyBoy said...

My experience has shown that as soon as your app hits 12MB, the OS shuts it down. Leaking large image references was how I found this out. :-)