Click here to Skip to main content
15,902,785 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Scrollbar problem Pin
Nelek20-May-07 20:50
protectorNelek20-May-07 20:50 
GeneralRe: Scrollbar problem Pin
Aint20-May-07 22:02
Aint20-May-07 22:02 
QuestionCString to const *char or clr Pin
Star0920-May-07 16:49
Star0920-May-07 16:49 
AnswerRe: CString to const *char or clr Pin
Christian Graus20-May-07 18:37
protectorChristian Graus20-May-07 18:37 
AnswerRe: CString to const *char or clr Pin
Manoj Kumar Rai20-May-07 20:17
professionalManoj Kumar Rai20-May-07 20:17 
AnswerRe: CString to const *char or clr Pin
prasad_som20-May-07 20:23
prasad_som20-May-07 20:23 
AnswerRe: CString to const *char or clr Pin
prasad_som20-May-07 20:20
prasad_som20-May-07 20:20 
QuestionCustom Caption in XP Pin
maxus9920-May-07 15:53
maxus9920-May-07 15:53 
AnswerRe: Custom Caption in XP Pin
Hamid_RT20-May-07 18:48
Hamid_RT20-May-07 18:48 
GeneralRe: Custom Caption in XP Pin
maxus9921-May-07 3:19
maxus9921-May-07 3:19 
QuestionSQL transaction rollback problem Pin
Moonis Ahmed20-May-07 15:12
Moonis Ahmed20-May-07 15:12 
AnswerRe: SQL transaction rollback problem Pin
zhang80060520-May-07 19:37
zhang80060520-May-07 19:37 
GeneralRe: SQL transaction rollback problem Pin
Moonis Ahmed20-May-07 19:50
Moonis Ahmed20-May-07 19:50 
GeneralRe: SQL transaction rollback problem Pin
Moonis Ahmed22-May-07 22:55
Moonis Ahmed22-May-07 22:55 
Questiondirect3d in layered wnd Pin
johny_d20-May-07 10:26
johny_d20-May-07 10:26 
QuestionHow to get hWnd in MFC? Pin
bankai12320-May-07 7:40
bankai12320-May-07 7:40 
AnswerRe: How to get hWnd in MFC? Pin
Hamid_RT20-May-07 7:57
Hamid_RT20-May-07 7:57 
AnswerRe: How to get hWnd in MFC? Pin
prasad_som20-May-07 20:16
prasad_som20-May-07 20:16 
QuestionPolygons / PtInRegion Pin
m.dietz20-May-07 6:49
m.dietz20-May-07 6:49 
Question_CrtSetBreakAlloc does nothing! Pin
dum20-May-07 6:37
dum20-May-07 6:37 
AnswerRe: _CrtSetBreakAlloc does nothing! Pin
Mark Salsbery20-May-07 7:09
Mark Salsbery20-May-07 7:09 
GeneralRe: _CrtSetBreakAlloc does nothing! Pin
dum20-May-07 8:50
dum20-May-07 8:50 
GeneralRe: _CrtSetBreakAlloc does nothing! Pin
Mark Salsbery20-May-07 9:04
Mark Salsbery20-May-07 9:04 
QuestionRe: _CrtSetBreakAlloc does nothing! Pin
dum20-May-07 9:47
dum20-May-07 9:47 
AnswerRe: _CrtSetBreakAlloc does nothing! Pin
Mark Salsbery20-May-07 11:00
Mark Salsbery20-May-07 11:00 
Hmm i don't know...

First, where are you putting the _CrtSetBreakAlloc() call? You'll want that as early in the
program execution as possible. If you still can't get it to break when you set
_CrtSetBreakAlloc() at the start of Main/WinMain (or your CWinApp constructor in MFC) then maybe
the allocation is occuring in a DLL.

Second, to get more detailed info (file/linenumber where allocation occurred):

Add this to your precompiled header .h file:

#ifdef _DEBUG
#include <crtdbg.h>
#define DEBUG_NEW new(_NORMAL_BLOCK ,__FILE__, __LINE__)
#else
#define DEBUG_NEW new
#endif

For non-MFC apps add this to the top of ALL your source modules, under the
last #include... line:

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

For an MFC app (as I mentioned before) add this to the top of ALL your source modules, under the
last #include... line:

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

I personally use these in EVERY file. The time it's saved me in debugging leaks has been HUGE
compared to the time it took to add these lines to hundreds of source files.


This link may help further: Memory Leak Detection Enabling[^]

Mark


"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.