DevPrep

All topics › Performance

How do you reduce the memory footprint and stay clear of jetsam?

Senior PRO

Essence

iOS has no swap to disk: when memory runs short, the system first compresses and drops clean pages, then terminates processes (jetsam). The decision is based on the footprint — the process's dirty plus compressed memory. Every app has its own limit, and in the background the app holding a lot gets terminated first. To the user it looks like "the app restarted", and there's no regular crash log.

The rest of this answer, with code and interview follow-ups, is in the DevPrep app.

Read the full answer in DevPrep

Practice this before your interview

DevPrep turns these answers into one-minute challenges: what does this code print, find the bug, mock interviews. One challenge a day.

Get DevPrep on the App Store