03-07-09 - Malloc
Arseny Kapoulkine has a nice new blog post about replacing CRT malloc .
I looked into it a while ago and gathered these links on the subject :
What your mother never told you about graphics development Fighting against CRT heap and winning TRET The Reverse Engineering Toolkit The Bag of Holding somecode Memtracer Practical Efficient Memory Management EntBlog New Fun Blog - Scott Bilas Figuring out how to override malloc and new MemTracer strikes back .mischief.mayhem.soap. Lightning Engine � Blog Archive � Tracking Memory Allocations Gamasutra - Monitoring Your PC's Memory Usage For Game Development Fast File Loading EntBlog Detours - Microsoft Research CodeProject Visual Leak Detector - Enhanced Memory Leak Detection for Visual C++. Free source code and programming help A Cross-Platform Memory Leak Detector
then I decided it was a pain in the ass and I wasn't going to do it. This is one place where C++ got it so much better - you can just override new/delete and it all works. I never use malloc/free anyway, so WTF the few people who do use them can go to the CRT heap, what do I care?
The new cblib has a simple lock-free paged small block allocator. It's very primitive and not as fast or efficient as it could be (it's very fast for single threaded but has very poor cache line sharing behavior), but on the plus side it is nice and simple and self-contained unlike tcmalloc or hoard or something which are like a huge mess of code.
BTW related to this all and the threading stuff is : LeapHeap
Hmm these were in that link bag and don't belong, but they are quite fun - HAKMEM -- CONTENTS -- DRAFT, NOT YET PROOFED Hacker's Delight