Take the 2-minute tour ×

I have a 32-bit Visual Studio 8.0 C++ Windows DLL (non-.NET) that appears to be taking up more memory than I would expect. I want to determine exactly where the memory is going, not just a single figure of the total memory used (not interested in Task Manager or Resource Monitor's memory usage values). Back in 16-bit days HeapWalker was very helpful and you could even select a BITMAP handle and view it's graphic contents. I'm trying to remember how to read a .MAP file and add up the various sections but there is very little documentation and I'm not sure how accurate this technique is. Anybody have any advice?

share|improve this question
<crtdbg.h> can certainly help. –  Hans Passant Mar 31 '09 at 3:03
add comment

1 Answer

up vote 2 down vote accepted

If you need to find the size of various sections of the DLL you can use dumpbin.exe. It is a command line tool for inspecting DLLs and executables. Be sure to run vcvars32.bat before trying to run it.

To look at the actual memory consumption of your DLL, I would suggest starting with umdh.exe. It ships as part of windbg from Microsoft. As long as you build your files with a pdb, it will will be able to resolve symbols in your application. You can then take a few snap shots of the memory to look for leaks. You can also do a complete dump of all allocations to see where memory is being allocated and how much is being allocated.

share|improve this answer
I had tried running dumpbin but got an error about a missing DLL. Didn't think to run vcvars32! I'll give your suggestions a try. I've been tracking dynamic allocations but the biggest hit is the first time the DLL is loaded so I'm looking at code size, static data and such. Thanks for responding. –  AlanKley Mar 30 '09 at 19:56
add comment

Your Answer


