470,590 Members | 2,249 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,590 developers. It's quick & easy.

How turn off memory leak dumping?

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

Nov 17 '05 #1
3 3123
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]

Nov 17 '05 #2
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!

--
Martin Richter [MVP] WWJD
"In C we had to code our own bugs. In C++ we can inherit them."
FAQ : http://www.mpdvc.de
Samples: http://www.codeguru.com http://www.codeproject.com
Nov 17 '05 #3

Hello Martin,
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!


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

Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by blugus | last post: by
7 posts views Thread by Rich Denis | last post: by
4 posts views Thread by ali.jan | last post: by
4 posts views Thread by Mike C# | last post: by
6 posts views Thread by eduard.antonyan | last post: by
3 posts views Thread by Jim Land | last post: by
22 posts views Thread by Peter | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.