Why is there no swap in iOS? What happens under memory pressure?
Why there is no swap
On iPhone anonymous memory (heap, stacks) is never paged out to flash: NAND has limited write endurance, and constant swapping on a mobile device would kill both the storage and responsiveness. Instead XNU uses the memory compressor — rarely used anonymous pages are compressed in RAM (typically 2–3×), while clean file-backed pages are simply evicted because they can be re-read from the file.
The rest of this answer, with code and interview follow-ups, is in the DevPrep app.
Read the full answer in DevPrep