Simple memory manager in c