views:

59

answers:

1

Hi I have application that I compiled with VS 2008 on windows 7 with c++ And I got exception I trying to catch this I created pdb file (because I compiled in release) . and see part of the stack ,but it doesn't give me hints on where the error. Im looking for free ways to get this error .can you recommend on free ways to do this?

+4  A: 

Visual C++ has pretty good C runtime memory debugging tools built in.

See #define _CRTDBG_MAP_ALLOC, or read: The CRT Debug Heap and Memory Leak Detection Enabling.

It can detect:

  • Memory leaks
  • Double deletes
  • Writing just past the ends of allocated memory

If you have a reproducible case, where the problem allocation always happens at the same time, you can use set it to break into the debugger on that allocation.

There are also commercial tools such as BoundsChecker, HeapAgent, and Purify, and free tools like Fortify, and of course you can roll your own, but you can get a long way with the built-in VisualStudio one.

Matt Curtis
@matt-curtis. Do you perhaps have a link to Fortify download? Thanks in advance.
ossandcad
can i test it in release mode ? co'z its where is my problem in debug it is working fine
@ossandcad: it looks like its last resting place was Geocities. I found a copy here: http://www.gnu-darwin.org/www001/src/ports/devel/adime/work/adime-2.2.1/include/fortify.h - IIRC 2.2 is the latest version.
Matt Curtis
@user63898: I'm not sure, I would imagine you could but it's probably a lot of mucking about. If it's any help, I have done a lot of debugging release builds, and the problems you see in release that you don't see in debug (once you account for `assert()` and so on) are almost always uninitialised variables and race conditions. Maybe this gives you some place to start?
Matt Curtis