How much memory can one iOS app use?

As of 2014 my minimum hardware testing device is an iPhone 4s running iOS7 with ~50 apps installed. After a reboot, the OS can free up 200mb out of 512 total. After a week of regular use, the best it can manage is 100mb.

I'm developing an Adobe AIR app which does not receive low memory warnings from the OS. If it gets near the limit, it crashes. So try to stay under 100mb if you want to run on devices with 512mb total ram. Remember, this is for the gpu and cpu combined.


I wrote a test app that measures how much memory an app can allocate before it's killed. Here are the numbers:

  • iPhone 5s (iOS 10, debug mode, 1GB memory): 600MB can be allocated
  • iPad Air 2 (iOS 11.4, 2GB memory): 1.3GB can be allocated
  • iPhone X (iOS 11.4, 3GB memory): 1.2GB can be allocated
  • iPhone 7 Plus (iOS 12.1, 3GB memory): 1.8GB can be allocated
  • iPad 13-inch (iOS 11.4, 4GB memory): 3GB can be allocated

It's interesting that I never got a memory warning.

Here's the code if you want to run the test yourself:

import UIKit

let sizeInMb = 100

class Wrapper {
  var array = [UInt8](repeating: 0, count: sizeInMb * 1048576)  // 100 MB
}

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        window = UIWindow(frame: UIScreen.main.bounds)

        var i = 0

        sleep(5)  // So that you can see how much memory it consumes before any allocations.

        while true {
            let w = Wrapper()
            Unmanaged<Wrapper>.passRetained(w)
            i += 1
            print("\(i * sizeInMb) MB allocated")
            sleep(1)  // Give the OS a chance to kill other processes.
        }

        return true
    }

    func applicationDidReceiveMemoryWarning(_ application: UIApplication) {
        print("Memory warning!")
    }
}

This does not work on the simulator. Anything regarding performance should be tested on device.


In case it's of interest to anyone else:

On an iPhone 12 Pro, with 6 GB of RAM (AFAIK), it allocated 2800 MB (almost half) before being terminated. YMMV


Hi I just tested with my app, for a 512MB device, the app will crash anytime after 250mb usage, giving "Memory Pressure" issue.