iOS Safari and memory management

Here’s what I don’t get about the iPhone’s Safari and memory management.

Safari will sometimes forget the website it has loaded and needs to reload them when you go to their tab. And they tell us that it’s because the iPhone has limited memory and when other apps need it, it has to free it. Unlike on the Mac, there is no virtual memory on the iPhone, so the system cannot automatically restore what was once removed from memory.

Okay, but why does Safari insist on keeping everything in memory? Why cannot Safari just save what it has downloaded to disk? My photos and videos don’t get destroyed when the phone is low on memory, why webpages should? Even if I opened a webpage a year ago, there is no reason on Earth to reload it from network when I want to look at it today. It’s already open, just show it to me! I didn’t press Reload, so please don’t do what you were not asked to.

I suspect it’s yet another corollary of general shittiness of modern browsers where developers are obsessed with JavaScript performance and security, and completely forget about being nice software.

Next
3 comments
Yakov Shapovalov 2019

IIRC, mobile Safari caches downloaded webpages and sometimes reloads them from storage.
At least, I could open an old cached page in airplane mode, but not every page can be reloaded in this fashion.

Tim 2019

Apple says: “Both OS X and iOS include a fully-integrated virtual memory system that you cannot turn off; it is always on.”

You say: “Unlike on the Mac, there is no virtual memory on the iPhone”

Where’d you get this information?

Ilya Birman 2019

Hmm, that’s what I heard. Anyway, it’s not a good idea to store websites in memory when they are not being used.

FJ 2019

iOS absolutely uses virtual memory; whether it swaps to disk (well, flash), and how *often* it swaps to disk, are a different story.