iOS memory allocation - how much memory can be used in an application?

Does iOs use non-contiguous or contiguous allocation in memory management? suppose if user allocates more than 128 MB, Will the App be closed? or Memory will be managed by iOS as if user allocates memory and misses deallocate in Deallocate method? is it possible to use more than 120 MB in application using well-defined data structure allocation?


You can use memory < your device ram capacity

(e.g. you're using 40 Mb of RAM, and then allocating 80 Mb's more for some short computation). In this case iOS would kill your application immediately.1

List of results found by users testing with this tool:

device: (crash amount/total amount/percentage of total)2

  • iPad1: 127MB/256MB/49%
  • iPad2: 275MB/512MB/53%
  • iPad3: 645MB/1024MB/62%
  • iPad4: 585MB/1024MB/57% (iOS 8.1)
  • iPad Mini 1st Generation: 297MB/512MB/58%
  • iPad Mini retina: 696MB/1024MB/68% (iOS 7.1)
  • iPad Air: 697MB/1024MB/68%
  • iPad Air 2: 1195MB/2048MB/58% (iOS 8.x)
  • iPad Pro 12.9: 3064MB/3981MB/77% (iOS 9.3.2)
  • iPad Pro 9.7": 1395MB/1971MB/71% (iOS 10.0.2 (14A456))
  • iPod touch 4th gen: 130MB/256MB/51% (iOS 6.1.1)
  • iPod touch 5th gen: 286MB/512MB/56% (iOS 7.0)
  • iPhone4: 325MB/512MB/63%
  • iPhone4S: 286MB/512MB/56%
  • iPhone5: 645MB/1024MB/62%
  • iPhone5S: 646MB/1024MB/63%
  • iPhone6: 645MB/1024MB/62% (iOS 8.x)
  • iPhone6+: 645MB/1024MB/62% (iOS 8.x)
  • iPhone6s: 1396MB/2048MB/68% (iOS 9.2)
  • iPhone6s+: 1195MB/2048MB/58% (theoretical, untested)
  • iPhoneSE: 1395MB/2048MB/69% (iOS 9.3)
  • iPhone 6s+: 1392MB/2048MB/ 68% (iOS 10.2.1)
  • iPhone 7+: 2040MB/3072MB/66% (iOS 10.2.1)
  • iPhone X: 1392/2785/50% (iOS 11.2.1)

1https://stackoverflow.com/a/5887783/5181636

2https://stackoverflow.com/a/15200855/5181636

More information can be found on this question.


Blocks from separate memory allocations are not allocated contiguously (separate calls to alloc, malloc, new, etc.). Otherwise they are allocated contiguously(from the same call to malloc, ex. new float[30]). According to Apple your app risks being shut down for memory usage when you use more than 20mb of ram. In practice however, you can get to about...

  • 260 MB of ram on iPad 2 (Thanks RobCroll)
  • 170-180MB of ram on devices with 512 Mb of ram total (iPhone 4, iPod touch 4g)
  • 40-80MB of ram on devices that have 256 MB of ram (iPad, iPhone 3gs, iPod touch 3g)
  • 25 MB on device with only 128MB of ram (IPhone 3g, iPhone 2g, iPod touch 1g-2g)

If you really "need" that much ram for a mobile application, you should really save the data to a temp file and do your processing on that. An easy way to do that is by using memory mapped files.


Under the hood iOS uses malloc and friends to allocate memory for every object, so yes the memory returned is indeed contiguous. If you try to allocate more than available contiguous memory the malloc call will return NULL (and probably something else will fail when trying to access a null pointer if not properly checked)


Currently memory management in iOS works without clear memory limit for an application. But you can handle the situation when iOS tells your app to release memory immediately or it will be closed.

Responding to Low-Memory Warnings in iOS

128MB is quite a big memory block for iOS. in case if you will try to allocate over memory limit an application will be closed without any notifications.