simple memory manager written in c++