I want to find memory leaks in my application using standard utilities. Previously I used my own memory allocator, but other people (yes, you AlienFluid) suggested to use Mi
The simplest solution is not to write the leaks or the buffer overflows in the first place - detecting them after the event is really a waste of effort. In my own code, for years I have had zero problems in these areas. Why? Becauase I use the mechanisms that C++ provides to avoid them. For example:
X *p1 = 0;
p1 = new X();
should be:
shared_ptr p1 = new X();
and you no longer worry about p1 leaking. Better still, don't use dynamic allocation at all:
X x1;
For buffer overflows, always use types like std::string which will grow on input, or if they do not grow will detect the possible overflow and warn you.
I'm not boasting about my prowess in avoiding memory leaks - this stuff really does work, and allows you to get on with the much more difficult task of debugging the business logic of your code.