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

If an app (even badly coded) causes memory leaks in the OS, that's a fault of the OS still. Of course fast moving OSes like Android or iOS are always going to have these kinds of bugs and it's probably not related to Swift as Swift isn't used in the kernel internals.


>If an app (even badly coded) causes memory leaks in the OS, that's a fault of the OS still.

How's that so? An app doesn't have to leak OS memory, just leak its own memory.


Well, leaking kernel memory is very different than leaking application memory, because one can be paged out while the other is wired permanently.


iOS does not swap.


It will page out clean pages as necessary, though.


Wired? All memory is always physically wired to the motherboard.

It's unsafe for the kernel to swap the memory out, because paging doesn't (usually) work while running kernel code.


Wired as in not swappable.


I write kernel mode drivers as my day job, and this is certainly the first time I've ever heard of non-swappable being called "wired".

It might be called "non-pageable", "pinned", "non-swappable", etc. Out of those, I'd prefer "non-pageable", because it's the most descriptive term for it.

Non-standard terminology is not great for communication.


I write kernel mode drivers as my day job, and this is certainly the first time I've ever heard of non-swappable being called "wired".

For what OS? Consider https://wiki.freebsd.org/Memory

Wired

    - Non-pageable memory: cannot be freed until explicitly released by the owner
    - Userland memory can be wired by mlock(2) (subject to system and per-user limits)
    - Kernel memory allocators return wired memory
    - Contents of the ARC and the buffer cache are wired
    - Some memory is permanently wired and is never freed (e.g., the kernel file itself)

OSX is derived from BSD.


> For what OS?

Check my other reply above. Did some FreeBSD work ~15 years ago, but I guess I'd already forgotten.


> I write kernel mode drivers as my day job, and this is certainly the first time I've ever heard of non-swappable being called "wired".

Really ? Because it's literally called that in macOS Activity Monitor app, the term is also used in Apple's kernel documentation and API's (e.g. in the `mem_and_io_snapshot` struct defined in 'debug.h' in Kernel.framework). It's also mentioned in the Kernel Programming Guide.


Interesting.

Never did macOS drivers, just bare metal, Windows and Linux so far, macOS is not very big in our niche. Weird that Apple's terminology is so different.

Typing this on a Macbook Pro, and I can see that Activity Monitor does mention "wired" memory.


I did a little googling and I see the terminology is also used in the Mach microkernel, which macOS's XNU kernel was built upon. It looks like it's not something Apple came up with.


It's a MacOS thing. "Wired" confused me also initially. All it means is pages marked as "Wired" can't be offloaded to swap.




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

Search: