A simple memory manager in C++