simple memory manager in written c++