Re: Overriding global new
Qt does it's own internal memory management, making use of smart pointers, copy-on-change and many other customized memory allocations/deallocations. You can dig around in the source code, or search on "Qt Memory Management" on Google, but the short answer is that Qt almost certainly isn't going to honor your modified new() and delete() operators because it implements it's own versions that will override yours.
Generally, overriding new() and delete() is considered bad programming practice, and conflicts like these are only one example of the problems it can cause. If you're going to do custom memory management, you should just do it, using your own routines, rather than overriding routines that are expected to have certain behavior. Same applies to the Trolls, who should also avoid such practices imho.
Re: Overriding global new
Hi,
Thank you for your reply. There is one thing I would like to know: Does Qt's new operator returns 0 on unsuccessful memory allocation or it throws bad_alloc memory exception?
Regards,