Conversation

Replying to
yes, but isn't performance going to be really bad if you never reuse freed memory. you're at the very least going to have a bunch more syscalls?
2
4
Replying to and
Indeed this example will be slow, but who calls malloc/free in a hot loop? There's also a much more granular safety story - you could allow some of your trusted dependencies to be compiled in ReleaseFast mode but most of your application in ReleaseSafe.
4
3
It has optional quarantines for both small and large allocations as separate features. Large means a mmap region with guards. In both cases, it has a random quarantine based on swapping with a random element in an array and a ring buffer as a queue for a deterministic delay.
1
2
For the large allocation quarantine, it replaces the allocation with fresh PROT_NONE pages so it's essentially a virtual memory quarantine. Either way, it always deterministically detects any invalid free of any pointer that's not a valid non-free, non-quarantined allocation.
1
2
Show replies
The large allocation quarantine is extremely cheap since it just turns deallocation from munmap into a MAP_FIXED mmap with PROT_NONE. It also has to start doing munmap as a 2nd system call once the quarantine is filled and old allocations are being pushed out of it.