Repo for easily comparing different C++ memory allocators.
For now it checks the safety features. Jemalloc and mimalloc don't seem to be better than glibc at detecting crashes. Please improve the tests if you find cases that aren't caught by all 3.
Benchmarks and tcmalloc to be added.
git submodule update --init --recursive
cmake --preset=debug
cmake --build build-debug
./run_example.sh --jemalloc ./build-debug/bin/demo_crash -d # double-free
./run_example.sh --jemalloc ./build-debug/bin/demo_crash -i # invalid pointer free
./run_example.sh --jemalloc ./build-debug/bin/demo_crash -u # use after free (not working)
You can pass --mimalloc
, --asan
or --glibc
instead of --jemalloc
.