Does anyone know where I can find a memory memory leak detection tool for C++ which can be either run in a command line or as an Eclipse plug-in in Windows and Linux. I would l
Valgrind is your best friend. Valgrind has a plugin for eclipse. "Sadly" Valgrind does not run on Windows, but it runs on Mac OSX, *BSD and Linux, so I'd consider that "multi-platform". :)
Valgrind does "overwrite" new/delete/malloc/free but not during compilation (so you don't have to recompile if that's what you mean). It interprets the binary so the performance suffer a bit during testing.
for 32 bits applications, valgrind + wine can be a working solution as well for windows apps. If your app can be run under wine without any change, then running it under valgrind + wine works well in my (quite limited) experience. Since your app works under Linux, I would guess that your app is likely to run under wine (avoids very windows specific code which is not yet supported in wine).
DUMA is a cross-platform leak detection library which I use for many of my projects. It's nice because you don't have to #include
any DUMA-specific header, but just link in the library before you link in your system's libc, which contains the memory allocation routines, and after linking in libstdc++.
It can be kind of tricky to set up, especially when used with C++ projects, but I think that it is well worth the time invested. It has helped me to find a few memory leaks before that I might not have discovered otherwise, and one case where I deleted an allocation twice.
One note: it's much easier if you build a static archive (built by default on Windows) because it helps to reduce "false positives" that are actually caused by leaky runtimes.
While you mentioned that this isn't preferred the Boehm Garbage Collector can be used to detect memory leaks. Simply put, if the garbage collector is ever actually running then generally you have a memory leak. It's used this way by Mozilla to detect memory leaks in Firefox.
In newer versions of gcc there is something called leak sanitizer. You just have to add -fsanitize=leak
to compile command. Then you run your program normally and at the end, if there was any leak, you'll get summary (in terminal of course).
There's the leaks
tool on MacOS X (i don't know if it exists elsewhere) and i used to use a tool called memprof on linux. There's also valgrind which works on linux and is incredibly awesome but has a substantial performance hit, and ostensibly on macos but i haven't tried it.
I am unaware of any such tools on windows however.