In short
- A jetsam event is the system closing apps to get memory back. When available memory runs low and apps don't free enough after a low-memory warning, iOS terminates processes and writes a `JetsamEvent` report explaining which one it chose and why.
- A jetsam report isn't a crash report. It's JSON, it lists the memory use of every process on the device, and it has no backtraces. Look for the one process that has a `reason` key: if it isn't your app, your crash has another cause.
- Fixing it means using less memory and giving it back when asked: size images to how they're shown, drop caches and view content you can rebuild, find leaks and unbounded collections, and respond to memory warnings quickly.
What a jetsam event is
iOS, iPadOS, tvOS, visionOS and watchOS rely on every running app giving memory back when the system runs short. When memory pressure builds, the system sends low-memory warnings; if the apps that receive them don't free enough, it terminates processes to reclaim their memory. Apple calls this a jetsam event, and the system records it in a jetsam event report.
To the person using your app, a jetsam termination while the app is on screen looks exactly like a crash: the app vanishes and the next launch starts cold. A termination while the app is in the background is quieter, but the user still loses their place when they come back. Both count against you.
| Crash report | Jetsam event report | |
|---|---|---|
| File name in Analytics Data | Starts with your app's binary name, then the date and time | Starts with JetsamEvent_, then the date and time |
| Format | Text (.crash) or .ips | JSON |
| What it covers | Your process only | Memory use of every app and system process on the device |
| Backtraces | Yes, for every thread | None |
| In Xcode Organizer's Crashes pane | Yes, from users who share data | No: get it from the device, or watch the termination counts described below |
Jetsam is one of several ways the system ends an app without a crash in your code. The watchdog terminations behind 0x8badf00d reports are a different one, caused by a blocked main thread; iOS App Hangs: How to Detect, Diagnose and Fix Them covers those.
Where to find jetsam event reports
- On the device, open Settings > Privacy & Security > Analytics & Improvements > Analytics Data. The menu path can move between iOS versions; Apple's support article on sharing analytics information has the current one.
- Look for files named
JetsamEvent_<date-time>from around the time the app disappeared. - Open one and tap Share to send it by Mail or AirDrop, or connect the device to a Mac and open the logs from Xcode's Devices and Simulators window.
Jetsam reports don't appear in Xcode Organizer's Crashes pane, so for a bug report from a customer you need them to send the file. Ask for the JetsamEvent files from the same day as the problem, along with any crash report from your app with a matching time.
Not a developer? These files are routine. The system writes one whenever it closes apps to free memory, often apps you weren't using, so having many of them isn't by itself a sign that anything is wrong with your iPhone. If one particular app keeps quitting while you use it, update it, and if it continues, send its developer the JetsamEvent file from around that time.
How to read a jetsam event report
The header describes the device: model (product), OS version (build), the time of the event, and two fields that matter most. memoryStatus.pageSize is the size of one memory page in bytes, which you need to turn page counts into bytes. largestProcess names the process using the most memory on the device at the time.
"product" : "iPad8,2",
"build" : "iPhone OS 13.1.2 (17A860)",
"memoryStatus" : {
"pageSize" : 16384,
...
},
"largestProcess" : "OneCoolApp",Below the header, the processes array has one entry per process. Search the file for "reason": only the process the system jettisoned carries that key. If that process isn't your app (or one of your app's extensions), the crash your user saw wasn't caused by memory pressure, and you need the regular crash report instead.
{
"uuid" : "a02fb850-9725-4051-817a-8a5dc0950872",
"states" : [ "frontmost" ],
"lifetimeMax" : 92802,
"purgeable" : 0,
"coalition" : 68,
"rpages" : 92802,
"reason" : "per-process-limit",
"name" : "MyCoolApp"
}| Field | What it tells you |
|---|---|
name | The process name. Check whether it's your app's binary, one of your extensions, another app or a system process. |
rpages | Memory pages the process was using. Multiply by pageSize for bytes: 92,802 pages × 16,384 bytes is 1,520,467,968 bytes, about 1.52 GB. |
lifetimeMax | The most pages the process held at any point in its life. If it's well above rpages, the app had a spike earlier. |
states | What the process was doing, such as frontmost (on screen) or suspended. |
uuid | The binary's build UUID. Match it against your archived dSYMs to know exactly which build the user was running. |
coalition | Groups your app with system processes doing work on its behalf. Your app can drive up their memory use too. |
Jetsam reason codes
The value of reason says what led to the termination. Apple documents these:
| Reason | What happened | What it means for you |
|---|---|---|
per-process-limit | The process went over the memory limit the system sets for each app | Your app (or extension) used too much memory. This is the one to fix first. App extensions have much lower limits than foreground apps. |
vm-pageshortage | The system was under memory pressure and freed background processes' memory for the foreground app | Your app was in the background. A smaller background footprint makes it a less likely target. |
vnode-limit | Too many files were open across the system | The system may terminate a background app to free vnodes even if that app isn't the one holding them. Close files you no longer need. |
fc-thrashing | A process read and wrote non-sequential parts of memory-mapped files too often, thrashing the file cache | Look at how you use memory-mapped files. As with vnodes, a background app can be terminated even if it isn't the cause. |
highwater | A system daemon went over its highest expected memory footprint | Usually not your app; system daemons get this reason. |
jettisoned | The process was terminated for some other reason | Check the surrounding reports and your own logs for what was happening at the time. |
If your app is regularly largestProcess and other apps are being jettisoned around it, that's worth fixing even when your app survives: a large footprint pushes everything else out, and the user notices other apps reloading.
How much memory an app can use
Apple doesn't publish a per-device memory limit, and the limit can change while the app runs. Don't hard-code a number you found in a forum. Ask the system at runtime instead: os_proc_available_memory() (iOS 13 and later) returns how many bytes your app can still allocate before it hits its current limit, or 0 if it's already over.
import os
// Bytes left before the current limit. Advisory only: don't cache it.
let available = os_proc_available_memory()
if available < estimatedBytesForFullQuality {
// Load a smaller working set: fewer pages, lower resolution, a smaller model.
}Use it to choose how much to load, not to fill memory up to the limit: using lots of memory forces the system to terminate other apps and processes, which makes the whole device slower. Apps whose core features genuinely need more memory can add the com.apple.developer.kernel.increased-memory-limit entitlement (iOS 15 and later). A higher limit is only available on some devices, so the app still has to work without it. On-device models are a common reason to look at this; On-Device LLM Inference on iPhone Using Apple Intelligence and Core ML covers that case.
Measuring memory, in development and in the field
| Tool | When it helps | What to know |
|---|---|---|
| Xcode memory gauge | Every debug run on a device | In the Debug navigator. The yellow region is where memory warnings start; red means the app risks termination. In the Simulator it always stays green, because macOS doesn't send memory warnings or out-of-memory terminations, so test memory on real devices. |
| Allocations instrument | Finding which feature grows memory | Shows heap and anonymous VM allocations over time. Use Mark Generation before and after a feature to isolate what it allocated. |
| Leaks instrument and Memory Graph Debugger | Finding memory that can't be freed | Leaks reports unreachable allocations with the stack that made them. The memory graph shows what holds on to what; turn on Malloc Stack in the scheme's Diagnostics to see where each object was allocated. |
| Xcode Organizer | After release, across users who share data | The Memory metric tracks footprint by app version and device. Use it to spot the release where memory use went up. |
| MetricKit | After release, in your own pipeline | Before iOS 27: MXMemoryMetric for peak memory, and MXAppExitMetric (iOS 14 and later) with cumulativeMemoryResourceLimitExitCount for foreground and background memory-limit terminations and cumulativeMemoryPressureExitCount for background terminations under memory pressure. From iOS 27: PeakMemoryMetric, ForegroundTerminationMetric, BackgroundTerminationMetric and MemoryExceptionDiagnostic, a diagnostic sent when the app or an extension is terminated for going over its memory limit. |
Field counts are the only way to know how often jetsam hits your users, since most of them will never send you a report. Instruments and MetricKit for iOS App Monitoring covers setting up the pipeline; check Apple's MetricKit documentation for which types exist on the OS versions you support.
Common causes, and what to do instead
| Cause | Do this instead |
|---|---|
| Full-size images decoded for small views. A decoded image takes about width × height × 4 bytes at 8 bits per channel, so a 4032 × 3024 photo is roughly 48 MB however small it's shown | Downsample with ImageIO to the size you display (example below). Size bundled assets to how they're shown. |
| Caches and dictionaries that only grow, such as every message or image loaded while scrolling a feed | Keep only what the current screen needs. Evict as the user scrolls away, or write it to disk and read it back later. |
| Leaks and retain cycles | Find them with Leaks and the Memory Graph Debugger; Memory Graph Debugger and Retain Cycle Detection in Swift walks through it. |
| Views, images, video and scenes kept alive in the background | Release view content when the app enters the background and rebuild it when it returns. A smaller suspended footprint makes vm-pageshortage terminations less likely. Work that has to run later belongs in a scheduled task: see iOS Background Tasks. |
| Long Core Data sessions without saving | Unsaved changes stay in memory. Save at sensible points; balance that against the cost of frequent disk writes. |
| One very large allocation at once | The system may not have time to send warnings before you hit the limit. Allocate in steps so other apps can free memory first. |
Heavy frameworks in an app extension, such as SpriteKit or a live MKMapView | Extensions have much lower limits. A static image from MKMapSnapshotter uses less memory than a map view. |
| Data you could recreate held in ordinary memory | Consider NSPurgeableData: when not marked in use, the system discards it under memory pressure without waiting for your app to respond. |
import ImageIO
import UIKit
func downsampledImage(at url: URL, to pointSize: CGSize, scale: CGFloat) -> UIImage? {
let sourceOptions = [kCGImageSourceShouldCache: false] as CFDictionary
guard let source = CGImageSourceCreateWithURL(url as CFURL, sourceOptions) else {
return nil
}
let maxPixels = max(pointSize.width, pointSize.height) * scale
let options = [
kCGImageSourceCreateThumbnailFromImageAlways: true,
kCGImageSourceShouldCacheImmediately: true,
kCGImageSourceCreateThumbnailWithTransform: true,
kCGImageSourceThumbnailMaxPixelSize: maxPixels,
] as CFDictionary
guard let image = CGImageSourceCreateThumbnailAtIndex(source, 0, options) else {
return nil
}
return UIImage(cgImage: image)
}Responding to memory warnings
The system warns apps before it starts terminating them, through any of: applicationDidReceiveMemoryWarning(_:) on the app delegate, didReceiveMemoryWarning() on active view controllers, UIApplication.didReceiveMemoryWarningNotification, or a dispatch source of type DISPATCH_SOURCE_TYPE_MEMORYPRESSURE. Warnings are best effort: if memory demand rises faster than warnings can relieve it, the system goes straight to jetsam.
import UIKit
@MainActor
final class ThumbnailStore {
private var thumbnails: [URL: UIImage] = [:]
private var observer: NSObjectProtocol?
init() {
observer = NotificationCenter.default.addObserver(
forName: UIApplication.didReceiveMemoryWarningNotification,
object: nil,
queue: .main
) { [weak self] _ in
MainActor.assumeIsolated {
self?.thumbnails.removeAll() // cheap to rebuild, so drop it all
}
}
}
}- Respond fast, and free things you can drop in one step: a cache, decoded images, an offscreen view hierarchy.
- Don't walk your whole object graph looking for things to release. iOS compresses memory the app hasn't touched recently, and reading it back to decide what to free brings it out of the compressor and makes memory demand worse.
- After a warning, allocate more conservatively for the rest of the session: smaller batches, lower-resolution previews, fewer items kept in memory.
A workflow for fixing jetsam terminations
- Confirm it's jetsam. Get the
JetsamEventreport from the time of the problem and check that your app is the process with areasonkey. If it isn't, look for a crash report instead. - Size the problem. Multiply
rpagesandlifetimeMaxbypageSize, note the device model and OS version, and match theuuidto a build. - Check the field data. Compare memory-limit termination counts and peak memory in Organizer or MetricKit across app versions to find when it started.
- Reproduce on a real device, ideally the oldest model you support, with the memory gauge open. Repeat the flow the user was in and watch for growth that doesn't come back down.
- Find what grows. Record the flow with the Allocations instrument and Mark Generation, then check Leaks and the memory graph for objects that should have gone away.
- Fix, then confirm in the field. After the release, check that memory-limit terminations and peak memory dropped for the affected devices.
Sources
- Identifying high-memory use with jetsam event reports (Apple)
- Responding to low-memory warnings (Apple)
- Gathering information about memory use (Apple)
- Making changes to reduce memory use (Apple)
- Acquiring crash reports and diagnostic logs (Apple)
- os_proc_available_memory() (Apple)
- Increased Memory Limit entitlement (Apple)
- MetricKit (Apple)