Writing a good memory manager isn't all that trivial. You have to address heap fragmentation, and there are tons and tons of edge cases. It's also not a place where you want any bugs in your code.
I wrote one [http://associatedtechs.com/rob/memory.cpp.html] about 6 years ago because the development environment I was using at the time had a pretty crummy built-in C++ memory manager. I was messing around with stress-testing some code and was having some pretty extreme fragmentation problems.
I'm not proud of it and it's incomplete, but what's there works OK and performed a lot better than the built-in memory manager, both in terms of speed and heap fragmentation. It uses a modified best-fit algorithm. It doesn't handle running out of memory very well, though.
I wrote one [http://associatedtechs.com/rob/memory.cpp.html] about 6 years ago because the development environment I was using at the time had a pretty crummy built-in C++ memory manager. I was messing around with stress-testing some code and was having some pretty extreme fragmentation problems.
I'm not proud of it and it's incomplete, but what's there works OK and performed a lot better than the built-in memory manager, both in terms of speed and heap fragmentation. It uses a modified best-fit algorithm. It doesn't handle running out of memory very well, though.