--- Comment #6 from David Chisnall <[hidden email]> ---
(In reply to Bill Sorenson from comment #5)
`MADV_FREE` and Linux's `MADV_DONTNEED` have different use cases. For C, where
malloc is called a lot more often than calloc, `MADV_FREE` provides much better
semantics. For higher-level languages or for higher-security applications
where we need to guarantee zero initialisation, `MADV_FREE` is useless because
we have to `bzero` on either allocation or deallocation.
As I said, at $WORK, we have a number of use cases where Linux's behaviour
gives significantly better performance (less cache churn from redundant
zeroing). We have to fall back to the zeroing behaviour when using anonymous
shared memory though and that's a big perf hit for us. A `MADV_ZERO` would be
a big win.
Note, however, that `MADV_FREE` is currently broken in the Linuxulator, because
the constant has a different value in FreeBSD and Linux and the Linuxulator
just passes the flags through unmodified.