In my current project I use my own custom allocators inspired by the article on BitSquid. I also replace new and malloc to help me track down where they are used (as this should be minimised – currently not called anywhere.)
I’ve read that many of the more mature C++ test frameworks (CppUTest for example) rely on their own new/malloc overloads. Are there any out there that don’t? My project is cross-platform (Windows, Linux, Mac and mobiles) if that helps.
(Edit: Initially forgot to mention that we don’t use Boost)
Boost Tests for example does not base itself on his own new/malloc overloads, I actually use BOOST TESTS and I have created new/malloc overloads to see where (line and file) memory leek happens.
BOOST is cross platform but since I do all my development on windows I used some prexistent overloads of malloc-like functions (crtdbg.h) and just overloaded the new operator. If you need your tests to be cross platform you can overload the mallocs manually.
the code below is the content of a .h file that is the last included file of every .cpp file.
I used this approach because some parts of boost (not the testing part) overload the new operator and I also have another library that internaly overloads the new operator so by including this at the end of the includes list I am sure that I do not mess with the internals of my libraries.
http://www.boost.org/doc/libs/1_48_0/libs/test/doc/html/index.html