How can I check for memory leaks on win32?

I know there are tools in xcode to check for memory leaks but how can I do it on windows? In Task Manager my app memory usages goes up and up and I’d like to track it down but I’m not sure how to see whats leaking.

Hi.

I don’t know too many free memory leak detectors for Windows, but you can try the following:

Windows Leaks Detector (I’ve never used it so I don’t know how good it is).

You can try the following technique or this one from Microsoft: crt_dbg1 Sample: C Run-Time Basic Debugging Features

Paid tools:

deleaker
purify (it’s also available for Linux and Mac)

There is a static analysis code tool that’s free and may help you find bugs on your source code. You should give it a try. I use it all the time. It’s called cppcheck

Regards.


Please,

Thank you very much Marcio! Couldn’t get the free one you suggested to work but your suggestions led me to find…

It’s free, integrates with the compiler, and gives a callstack for leaks and is working quite nicely in helping me track down some of my leaks. Thanks for your help, never would have thought to look for this stuff online. My background in programming isn’t in these types of applications where I have to worry about memory.

One more question for you, does looking at memory usage in Task Manager give reliable information? For instance, if I switch between 2 scenes over and over I see memory usage in Task Manager go up and up, however my leak detector is not reporting any leaks here.

Thank you Chad.

This tool you found out looks very interesting.

Memory leaks are hard to figure out, specially when you don’t have the source code :slight_smile:

Maybe your program don’t have memory leaks… maybe it’s just not releasing memory while running.

Are you sure you’re not allocating more and more memory? Ideally you should reuse it.

I made a research and I found out there is a tool that may help you find leak but it’s not that user friendly. It’s named udmhtools. You need to install windows DDK (Driver Development Kit).

You can get more information about it here and here is a brief tutorial. Note that tutorial is for windows 2K but I think it applies to other versions of windows.

Regards.


Please,