Search code examples
c++memorymemory-managementwxwidgets

Custom memory allocation in wxWidgets


Is there a way to use custom allocators for ALL of wxWidgets? As in it always grabs memory from a certain memory allocator? I have not found any topics on this in the past and I don't see a way through the documentation to have this. If there is, could someone please provide an example of how to do so.


Solution

  • You should be able to overload the global new and delete. At least that is what wxWidgets internally uses when you enable debugging memory.

    But there might be some problems with that.

    You can also just edit the wxWidgets source to use your own allocators by overloading new and delete as they do in wx/memory.h