Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > Visual C++
|
Visual C++ Questions specific to Microsoft's Visual C++. For questions not specific to this Microsoft version, use the C++ Programming forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual C++ section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 13th, 2006, 12:45 PM
Registered User
 
Join Date: May 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Avihay
Default Memory leaks(CRTDBG_MAP_ALLOC)

Hello, as u can imagine, I have memory leaks. I added
#define CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
in afxstd.h, and ran it through the VC. Most of the memory dumps were
with no file name/file line, only a small minority had this data. My application is a multithreaded one, with a lot of dlls, and I run it in debug configuration. At some point i tried to add "_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
" in all kind of places but it didn't change anything.

can anyone have any idea of what can cause it (i.e- some dumps has file data, but the vast majority haven't), and more important, how can i solve it?

Thanks.

 
Old November 16th, 2006, 02:09 AM
Registered User
 
Join Date: May 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Avihay
Default

Well, I got no reply from here, but I did make some progress.
In order to get the file name and file line one should unclude the following lines in wach .cpp file:

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


 
Old November 17th, 2011, 01:48 PM
Registered User
 
Join Date: Nov 2011
Posts: 4
Thanks: 5
Thanked 0 Times in 0 Posts
Default

you need to use deleaker or valgrid. It is best to use first.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Prevent memory leaks.... benfowler C++ Programming 2 July 19th, 2008 09:11 PM
Memory akkad C# 0 January 9th, 2007 10:01 AM
Out of Memory ocabrera70 Classic ASP Components 0 February 15th, 2006 09:08 PM
Out of memory : simplyAns All Other Wrox Books 0 November 9th, 2004 08:56 AM
Memory linguva Access 2 December 19th, 2003 07:22 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.