by OskarS · 7y ago · 0 comments
Are you really saying that this is not possible with malloc, you have to drop down to platform-dependent system calls like mmap?
This means that writing zero is unlikely to cause a real allocation to occur. Writing a non zero value may be more likely to cause a page allocation.
That said: it can be entirely legal for a platform to do more page deduplication than just special casing the zero page. Linux has some kernel tooling called KSM (kernel same page merging).