Memory allocator API and implementation
