4 ms·
iOS does have virtual memory, it just doesn't swap pages to disk. The first iPhone had very slow flash, so swapping pages would totally kill performance.
by rhinoceraptor 7y ago
iOS does have virtual memory, it just doesn't swap pages to disk. The first iPhone had very slow flash, so swapping pages would totally kill performance.
- ymolodtsov 7y agoIt's a shame we all still go around with the first iPhones in our pockets for sure :)
- rhinoceraptor 7y agoI think in most cases the tradeoff of re-initializing app state, or forcing developers to cache state to disk manually is better than forcing the poor phone's disk to constantly swap and having developers be lazy and consume a ton of RAM.
- 0815test 7y agoMore relevantly, swapping pages to flash storage would kill the flash storage itself. (Flash memory has terrible write endurance, and what endurance it has relies on obscure GC algorithms that would interact quite terribly with a "swap file"-like pattern!) Performance isn't actually a huge concern until you start swapping out your working set (i.e. actively threshing); even swapping to spinning rust, which has terrible performance, is better than having no swap at all! Edit: You could still swap out to "external", modular storage like an SD card, since killing that would be no big deal - just treat it as disposable. But no SD card slot on iPhones :-P