Wednesday, April 20, 2011

What are some good tools for measuring memory allocations on Windows?

I have an application that keeps using up more and more memory as time goes by (while actively running), but there are no leaks. So I know the program isn't doing something totally wrong, which would be easy to find.

Instead I want to track allocations so I can start tracking down the issue, and on a Mac I'd use Instruments, which gives a detailed profile of what objects have been allocated, and by whom, but on Windows what would I use?

Currently I'm working with C/C++ on Windows XP, using VS2005. So any tools for this setup would be great, and hopefully tools that are free or at least provide a few weeks of trial, because it'll take a while to complete any purchase (corporate stuff) if necessary, and I have deadlines.

Thanks!

Edit: I'm using VLD, so I know the program has no Leaks, but it seems to be hogging more memory than needed, and not returning it, so I need to track allocations, not leaks.

From stackoverflow
  • Glowcode is here. It has the worst user interface in the world. The internals have the stuff though, if you have the patience to struggle through the horror that is trying to get it to work right. There is a 21 day free trial. I've found it to be a lifesaver, but you really have to want to find that bug.

    Robert Gould : After trying Glowcode out, I remember I'd used it about 4 years ago, but seems like it hasn't changed much since then :) Anyways it works, but Canopus MemoryValidator has a much friendlier UI
    1800 INFORMATION : If anything it has gotten worse. I kind of like it though. I think I have debugger Stockholm syndrome
  • Visual Studio Enabling Memory Leak Detection

    The primary tools for detecting memory leaks are the debugger and the CRT debug heap functions. To enable the debug heap functions, include the following statements in your program:

    #define CRTDBG_MAP_ALLOC
    #include <stdlib.h>
    #include <crtdbg.h>
    

    http://msdn.microsoft.com/en-us/library/e5ewb1h3(VS.71).aspx

    1800 INFORMATION : Will this help if there are no actual memory leaks? I think he is talking about a situation of increasing memory usage over time, not necessarily a leak
    Robert Gould : Sorry but I'm not talking about memory Leaks, my program cleans itself perfectly when it finishes, no leaks what so ever. The issue is it keeps allocating and allocating but doesn't return memory until it exits, or something like that.
  • Memory validator would be ideal for you. http://www.softwareverify.com/cpp/memory/index.html

    Robert Gould : Great tool! Just what I needed, thanks

0 comments:

Post a Comment