Qt Malloc / Free over-riding
-
We are having Qt4.8.2 working on Mips based Platform.
For our requirement, we would like to use our own malloc/new and free/delete and not from standard library.
In the above scenario, I can over-ride the new/delete operator easily. For malloc/free, LD_PRELOAD can be used for custom malloc/free.My question is - does Qt provides a any way to "over-ride" malloc/free? OR any other better way, compared to as described above?
-
Qt doesn't directly provide an ability to override symbols, as that's not really in the scope of Qt. It's something the linker needs to take care of (in terms of malloc/free), and Qt has no control over the linker.
-
Qt's containers use qMalloc / qFree / qRealloc which are wrappers around the standard library functions.
You can replace qmalloc.cpp in the QtCore library to use a different allocator.That won't help for c++ new / delete which are used directly.