How turn off memory leak dumping?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

My Vis C++ program takes forever to exit. Reason: it is dumping potential
memory leaks. I like finding leaks once a month, but not every time I run.
How do I turn mem leak dumping off?

I looked in help, and it said leak dumping is enabled with #define
CRTDBG_MAP_ALLOC ... but I do not have that #define anywhere in my code.

I _do_ have the /RTC1 (same as both /RTCs and /RTCu ) but the help for those
says nothing about memory leaks; and Id like to leave /RTC1 on all the time.

Thanks in advance for any help,
neal
 
My Vis C++ program takes forever to exit. Reason: it is dumping potential
memory leaks. I like finding leaks once a month, but not every time I run.
How do I turn mem leak dumping off?

I looked in help, and it said leak dumping is enabled with #define
CRTDBG_MAP_ALLOC ... but I do not have that #define anywhere in my code.

In non-MFC applications, you can use _CrtSetDbgFlag function.
(Since the leaks are dumped, it is possible that this function is already used somewhere
in the application)

In MFC applications, you can use AfxEnableMemoryTracking function.

Regards,
Oleg
[VC++ MVP]
 
Hallo Oleg!
In non-MFC applications, you can use _CrtSetDbgFlag function.
(Since the leaks are dumped, it is possible that this function is already used somewhere
in the application)

In MFC applications, you can use AfxEnableMemoryTracking function.

The MFC version finally calls _CrtSetDbgFlag too!
 
Hello Martin,
The MFC version finally calls _CrtSetDbgFlag too!

Yes, it does.

Calling AfxEnableMemoryTracking(FALSE) is just a bit simpler and less error prone
(e.g. because it is natural to use _CrtSetDbgFlag to clear _CRTDBG_LEAK_CHECK_DF
flag and expect it to suppress the leak report, but in case of MFC it will not work.
Instead _CRTDBG_ALLOC_MEM_DF should be cleared, and that's what
AfxEnableMemoryTracking does)

Oleg
 
Back
Top