tinyxml2
tinyxml2 copied to clipboard
Replace new/delete calls for Block* with malloc and free
Hello,
I am writing a program in which the new and delete operators are overloaded in order to use a custom allocator, and I found that the new and delete calls to allocate and deallocate memory for Block* in MemPoolT was causing several memory issues. I fixed these by replacing these with malloc() and free(). I'm not sure exactly why these issues were occurring.
EDIT: I believe this is because my allocator deconstructed the memory before the memory pool, meaning the memory pool was trying to deallocate memory that no longer exists
I personally think that replacing the new / delete operations with malloc and free is a really bad idea. Maybe it would be helpful if you could describe the issues you got in MemPoolT more in detail?