a simple memory manager