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.
- What should an app do on a memory warning, and how reliable is the warning?
When free memory gets low the system sends a memory warning: didReceiveMemoryWarning on view controllers, UIApplication.didReceiveMemoryWarningNotification for… - What is jetsam, and how does it differ from a crash?
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.
- What is the watchdog, and what causes the 0x8badf00d exception?
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
- 6.1 · The process, the sandbox, entitlements and privacy prompts
- 6.2 · App and scene lifecycle in UIKit and SwiftUI
- 6.3 · The run loop, its modes, and the main-thread contract
- 6.4 · The launch path: dyld, initialisers and the first frame
- 6.5 · Background modes, BGTaskScheduler and background transfers
- 6.7 · Info.plist, URL schemes, universal links and associated domains
- 6.8 · App groups, keychain groups and extensions as separate processes
- 6.9 · How a process dies, what it costs, what confines it and what seals it
- 6.10 · Threads and run loops, observers, and what actually runs in a custom mode
- 6.11 · Launch arguments, the scene callbacks, and reading a binary and its plists