memory allocator for educational purpose