Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

They aren’t actually too similar. They both use XNU, but the memory model is completely different. On macOS memory can be paged to/from disk. On iOS it isn’t and applications must free memory when asked or be terminated [0].

iOS applications are sandboxed by the kernel, with no opt out. macOS applications are not sandboxed by default and are opt in.

Then there are the API and UI differences.

EDIT: That linked blog post in the parent blog post also shows how different the userspace is: https://worthdoingbadly.com/macappsios/

EDIT: iPadOS 16 enables virtual memory swap [1]

[0] https://developer.apple.com/library/archive/documentation/Pe...

[1] https://www.apple.com/newsroom/2022/06/ipados-16-takes-the-v...




> On macOS memory can be paged to/from disk. On iOS it isn’t and applications must free memory when asked or be terminated

Not sure what you meant by that, you always could `mmap` files into memory on iOS. Back in the 32 bits days there was a ~700 MB limit due to the address space, but there aren't anymore nowadays with 64 bits. If `didReceiveMemoryWarning` is called on your app, then you need to free resident memory but the kernel will take care of dumping file-backed memory pages for you.


> Back in the 32 bits days there was a ~700 MB limit due to the address space, but there aren't anymore nowadays with 64 bits.

Not true, unless something changed recently (definitely more recently than the 32->64 transition). All iPhones have a virtual memory limit (although the limit is higher on phones with more physical RAM).

I know this for sure because several years ago I was the main person in charge of reducing OOM kills on the Facebook iPhone app and virtual memory exhaustion on 64-bit phones was definitely an issue.

See here for where this is enforced in XNU: https://github.com/apple-oss-distributions/xnu/blob/xnu-1121...

I assume Apple does this specifically because they want to prevent apps from simulating swap space by mapping a big file and allocating from it.


That's memory mapping. This is memory paging [1]. I.e. Windows pagefile.sys, Linux swap, macOS swap files. iOS does not have swap files, only memory compression. If you're on a Mac, open up Activity Monitor, go to Memory, and at the bottom there is `Swap Used`. That doesn't exist on iOS. So, if more memory is used than available, applications will need to free memory or be terminated. Unlike macOS, where some used memory will be swapped to disk to allow other stuff to be loaded into memory.

[1] https://en.wikipedia.org/wiki/Memory_paging


It's most likely just disabled rather than being completely different/non-existent. But yes, the application model is built around limited to no multitasking.


> It's most likely just disabled rather than being completely different/non-existent.

As evident by the limited Virtual Memory Swap enabled on iPadOS 16, but not iOS.

All Apple devices use the XNU kernel. But, as the parent blog post shows, the kernel configuration, device tree, and drivers are different.


> how different the bootloaders are for iOS vs MacOS





Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: