6.6 · Memory warnings, jetsam and the watchdog

An iOS app can be ended without a crash and without a callback. These questions are about the two ways it happens that you can influence: running out of memory, and not responding in time.

Mental model. A crash is your code failing. A jetsam kill or a watchdog kill is the system deciding you are too costly or too slow. The logs look different, and so does the fix.

Running out of memory

The warning you may get, and the kill you may not.

  1. What should an app do on a memory warning, and how reliable is the warning? 6.6.1 · L3
    When free memory gets low the system sends a memory warning: didReceiveMemoryWarning on view controllers, UIApplication.didReceiveMemoryWarningNotification for…
  2. What is jetsam, and how does it differ from a crash? 6.6.2 · L5
    Jetsam is the kernel’s memory-pressure killer. When free memory drops, it terminates processes in priority order: suspended apps first (they run nothing and…

Not responding

The watchdog and the 0x8badf00d exception.

  1. What is the watchdog, and what causes the 0x8badf00d exception? 6.6.3 · L5
    The watchdog is a system supervisor that terminates an app that fails to make progress in a required time. It applies at specific moments: launching (the app…

More in iOS platform internals