c++qt

Qt and custom allocators


I am using QtCore, QtGUI, QtWidget with C++ and would need to track memory allocations to fix huge performance issues in my project. I have custom tracking mechanism, but would need to override malloc/new for the internal allocations that Qt does. Googled for a malloc hook or callback or something like that that Qt provides, but couldn't find. Can anyone tell me if there is a direct way to inform Qt to use custom allocators?


Solution

  • I would try to define own debug new and delete operators. There is a relative question for that: Does Qt allready have its own new and delete operators? I can trust the answer from there and the task is about redefining C++ own operators then.

    But mind that we want global scope operators covering all C++ allocations: How to properly replace global new & delete operators