Page 1 of 1

Memory leak detection under WIndows

Posted: Tue Nov 11, 2008 11:23 pm
by coder99
One of the reasons I am still working with MSVC is that it includes fairly good support for memory leak detection.

I have looked around for open source replacements for this to use with CL.
Before I start my own search and experiments, does anyone have any recommendations or comments?

TIA

Re: Memory leak detection under WIndows

Posted: Wed Nov 12, 2008 1:46 pm
by frank_frl
First of all is it a good practice to write the appendant free or delete right after allocating memory. ;)

Frank

Re: Memory leak detection under WIndows

Posted: Thu Nov 13, 2008 12:10 am
by sdolim
This post at stackoverflow.com has a lot of useful suggestions for this question:

http://stackoverflow.com/questions/4562 ... naged-code

One free tool mentioned on that page that might be very helpful is DebugDiag from Microsoft:

http://www.microsoft.com/downloadS/deta ... laylang=en

The blurb on the tool's home page says this:
The Debug Diagnostic Tool (DebugDiag) is designed to assist in troubleshooting issues such as hangs, slow performance, memory leaks or fragmentation, and crashes in any Win32 user-mode process.
It appears you don't have to instrument your code. Haven't tried it yet myself, but I think I'm going to.

Re: Memory leak detection under WIndows

Posted: Fri Nov 14, 2008 5:44 am
by coder99
Wish things were so simple to follow frank_frl' s advice ;-)

I've had a brief look at the stackoverflow commentary and I have used/heard of several of the products described, but I was hoping for some comments from people using CL as to what they have found useful or useless :-).

I will give some of the recommended product a bit of a try, if I find the time to get them installed and working.

At present it is far easier for me to try and keep a parallel MSVC project going and to switch to it for some testing. Might have to dust off some of my own old code and polish it up.

Unfortunately it looks like the wxWidgets stuff does not work with MINGW :-(
Oh well, ......

Re: Memory leak detection under WIndows

Posted: Sat Nov 15, 2008 3:29 pm
by marfi
Hi, I use Valgrind ( together with its GUI called Valkyrie ) on Linux. It works (slowly, but works ;) with console apps as well as with wxWidgets. It would be a nice to integrate it with CL. Unfortunately, it is not designed for MS Windows...

Re: Memory leak detection under WIndows

Posted: Sat Nov 15, 2008 5:24 pm
by eranif
marfi wrote:Hi, I use Valgrind ( together with its GUI called Valkyrie ) on Linux. It works (slowly, but works ;) with console apps as well as with wxWidgets. It would be a nice to integrate it with CL. Unfortunately, it is not designed for MS Windows...
I am familiar with valgrind and I am working with it at work. However, since it does not cross platform, I avoided making a plugin for it

Eran

Re: Memory leak detection under WIndows

Posted: Sat Nov 15, 2008 11:15 pm
by coder99
I had heard of it but since it won't run under Windows, I sort of left it alone :-(

But I'll keep looking and trying