views:

5334

answers:

4

Different iPhones have different published memory 4GB, 8GB and 16GB. The touch can have 32GB. My understanding is this is the off-line memory (disk alike).

How much actual fast ram is there in the device available for my Cocoa Application?

Is there a preconfigured virtual amount?

+15  A: 
  • iPhone
    • 1st generation: 128MB
    • iPhone 3G: 128MB
    • iPhone 3GS: 256MB
    • iPhone 4: 512MB
  • iPod touch
    • 1st generation: 128MB
    • 2nd generation: 128MB
    • 3rd generation: 256MB
  • iPad
    • 1st generation (WiFi, 3G): 256MB

iOS doesn't support swapping memory pages to disk, therefore only RAM will be available to processes (however, it does support paging executables).

Mehrdad Afshari
You mean it doesn't support paging memory (to flash in this case). I'm sure that it supports virtual memory.
JeeBee
By virtual memory, I didn't mean virtual address space. In fact it does support paging too, but not paging to flash (i.e. no swap files).
Mehrdad Afshari
There's no paging of data, but readonly pages (ie instruction data) will be freed and reloaded as needed.
Mike Akers
Think of it as an OS X kernel without any swap files, it'll still page executables.
Mehrdad Afshari
This is probably because unlike a harddrive flash memory can only be written to a limited number of times... before it fails. So this scheme vastly improves memory life.
Tony Lambert
+6  A: 

As Mehrdad Afshari says, it's 128Mb (except for the 3GS which has twice that), but why do you need to know? Not all of it is accessible to programs and the exact amount varies. Presumably activities like running iPod in the background saps some memory and OS2.1, for instance, seemed to leave less free memory than 2.0.

The key, application wise, is to cache stuff rather than require everything in memory and to heed the memory warning notifications. Your app will be forced to quit if you don't. (If it quits with status 101, you were using too much memory.)

Stephen Darlington
because I am writing an application with an in memory database. I will write it in a different way depending on how much memory is available.
Tony Lambert
+7  A: 

iPhone and iPod touch has 128 megs of ram, but 3rd party applications should only count on having about 20 megs available.

Mike Akers
+3  A: 

Currently released Apple iOS devices have the following amounts of working memory:

iPhone 2G     = 128MB
iPhone 3G     = 128MB
iPhone 3GS    = 256MB
iPhone 4      = 512MB

iPod Touch 1G = 128MB
iPod Touch 2G = 128MB
iPod Touch 3G = 256MB

iPad          = 256MB
Tony Lambert
Tony - there are multiple versions of the iPod Touch also - you should include those variations as well. Good summary!
Josh