Click here to Skip to main content
16,016,527 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Memory Leaks Pin
JohnnyG22-May-02 5:11
JohnnyG22-May-02 5:11 
GeneralRe: Memory Leaks Pin
Chris Losinger22-May-02 9:07
professionalChris Losinger22-May-02 9:07 
GeneralRe: Memory Leaks Pin
JohnnyG22-May-02 9:19
JohnnyG22-May-02 9:19 
GeneralRe: Memory Leaks Pin
Chris Losinger22-May-02 9:27
professionalChris Losinger22-May-02 9:27 
GeneralRe: Memory Leaks Pin
JohnnyG22-May-02 10:00
JohnnyG22-May-02 10:00 
GeneralRe: Memory Leaks Pin
Chris Losinger22-May-02 10:49
professionalChris Losinger22-May-02 10:49 
GeneralRe: Memory Leaks Pin
JohnnyG22-May-02 10:56
JohnnyG22-May-02 10:56 
GeneralRe: Memory Leaks Pin
Chris Losinger22-May-02 5:12
professionalChris Losinger22-May-02 5:12 
here's a better way:

add this code to your app:

#ifdef _DEBUG
void* operator new(size_t nSize, const char * lpszFileName, int nLine)
{
 	return ::operator new(nSize, 1, lpszFileName, nLine);
}
#define DEBUG_NEW new(THIS_FILE, __LINE__)

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

then call _CrtDumpMemoryLeaks(); at the end.

this simply adds the line number and file to the memory allocation. (only works with "new", of course)




Cheap oil. It's worth it!

GeneralRe: Memory Leaks Pin
JohnnyG22-May-02 5:19
JohnnyG22-May-02 5:19 
GeneralRe: Memory Leaks Pin
Chris Losinger22-May-02 5:21
professionalChris Losinger22-May-02 5:21 
GeneralRe: Memory Leaks Pin
PJ Arends22-May-02 8:45
professionalPJ Arends22-May-02 8:45 
GeneralRe: Memory Leaks Pin
jbarton22-May-02 6:57
jbarton22-May-02 6:57 
GeneralRe: Memory Leaks Pin
Chris Losinger22-May-02 7:05
professionalChris Losinger22-May-02 7:05 
GeneralRe: Memory Leaks Pin
jbarton22-May-02 7:18
jbarton22-May-02 7:18 
GeneralRe: Memory Leaks Pin
JohnnyG22-May-02 8:55
JohnnyG22-May-02 8:55 
GeneralRe: Memory Leaks Pin
Tim Smith22-May-02 8:58
Tim Smith22-May-02 8:58 
GeneralRe: Memory Leaks Pin
Alex Cramer22-May-02 20:53
Alex Cramer22-May-02 20:53 
GeneralCListBox avoid (scrollbar-)repaint while updating items Pin
22-May-02 3:47
suss22-May-02 3:47 
GeneralRe: CListBox avoid (scrollbar-)repaint while updating items Pin
Chris Losinger22-May-02 3:56
professionalChris Losinger22-May-02 3:56 
GeneralRe: CListBox avoid (scrollbar-)repaint while updating items Pin
Tim Smith22-May-02 4:56
Tim Smith22-May-02 4:56 
GeneralRe: CListBox avoid (scrollbar-)repaint while updating items Pin
22-May-02 8:25
suss22-May-02 8:25 
QuestionStructs: on heap or stack? Pin
Anton A. Loukine22-May-02 3:48
Anton A. Loukine22-May-02 3:48 
AnswerRe: Structs: on heap or stack? Pin
Joaquín M López Muñoz22-May-02 4:23
Joaquín M López Muñoz22-May-02 4:23 
GeneralRe: Structs: on heap or stack? Pin
Anton A. Loukine22-May-02 6:31
Anton A. Loukine22-May-02 6:31 
GeneralRe: Structs: on heap or stack? Pin
Joaquín M López Muñoz22-May-02 6:44
Joaquín M López Muñoz22-May-02 6:44 

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.