What does HackerNews think of mimalloc?
mimalloc is a compact general purpose allocator with excellent performance.
Something that came out of the Koka project that everyone should know about is mimalloc [2]: if your built-in malloc is not doing it for you, this is the alternative allocator you should try first. Mimalloc is tiny and it has consistently great performance in concurrent environments.
[0]: https://github.com/microsoft/mimalloc [1]: https://news.ycombinator.com/item?id=25464354
HN discussion from 2019: https://news.ycombinator.com/item?id=20249743
https://github.com/koka-lang/koka https://github.com/microsoft/mimalloc
https://github.com/microsoft/mimalloc
https://github.com/microsoft/mimalloc/blob/master/include/mimalloc-atomic.h
It has gone through testing with Clang's TSAN and (at least some with) the GenMC model checker. https://plv.mpi-sws.org/genmc/
In [mimalloc](https://github.com/microsoft/mimalloc) we use a similar strategy to protect the free list in secure mode. However, there are some weaknesses associated with using a plain _xor_ -- if the attacker can guess `P` that reveals the key immediately (`P^key^P == key`) or even if there is a read overflow, and the attacker can read multiple encodings, they can xor with each other, say `(P1^key)^(P2^key)` and then we have`(P1^P2)` which may reveal information about the pointers (like alignment).
What we use in _mimalloc_ instead is two keys `key1` and `key2` and encode as `((P^key2)<<Just some thoughts. Of course, this may be too much for the use-case. However, we found just little extra overhead for the extra operations (as most programs are dominated by memory access) so it may be of benefit.