Friday Free Software Appreciation Day!
👉 jemalloc/jemalloc https://github.com/jemalloc/jemalloc
This is a C malloc implementation. It's meant to be included into your code, then it'll be used instead of the default function that allocates memory.
I have never thought about replacing that functionality.
Q: How much code can that be?
A: Quite a bit!
This project seems to be quite a feat. I also didn't understand much from a cursory reading. Totally out of my league.