_CrtSetDbg to look for memory management errors

  • From: "Delaunay Christophe" <christophe.delaunay@xxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Tue, 30 Oct 2007 15:33:03 +0100

Hi list,

I'm developping in C++ with Visual Studio 2003 and am currently
experiencing a critical memory management problem. I've written a really
annoying bug somewhere in my code which cause some of my buffers to be

I'd like to do the following in order to track my bug(s):

(1) Call _CrtSetDbgFlag(_CRTDBG_CHECK_ALWAYS_DF) at the beginning of my
main module in order to thoroughly check the heap of my app during its

(2) Redirect the so-called "debug heap manager" messages to some file
other than the Visual Studio Output Window.

This is this second operation I don't know how to perform. Please could
someone explain me which calls I should insert into my code to perform
this debug heap manager output and error redirection?

Many thanks in advance. Have a nice day. ChD
View the list's information and change your settings at

Other related posts: