tinyxml2 icon indicating copy to clipboard operation
tinyxml2 copied to clipboard

Replace new/delete calls for Block* with malloc and free

Open Hallett-K opened this issue 3 years ago • 1 comments

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

Hallett-K avatar Nov 12 '21 23:11 Hallett-K

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?

khReichel avatar Jan 01 '22 18:01 khReichel