I can't understand how to properly free the memory by pointer a
MemoryManager mm;
char* a = new(mm) char[len];
I can't understand how to properly free the memory by pointer a
MemoryManager mm;
char* a = new(mm) char[len];
You just call the destructor (if needed) and deallocate with your memory manager
// Deallocate memory
MemoryManager.free(a);
Or, you could define a delete operator for your custom allocator:
void operator delete(void *ptr, const MemoryManager &m) {...}
...
operator delete(a, mm);