of problem .
which could give some ASSERT msg which would not crash be an issue.
Why do you have the
#pragma once?
Just use this:
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
I just checked something. If you have to use CrtMemCheckpoint, then
you are not MFC ready.
I have a lot of test and design code that are console only, where I
will isolate a new class and do rapid development and testing under my
programmer editor.
To use the crtdbg.h, here is an example test code using this crtdbg
facility:
---------------------- CUT HERE --------------------------
// File: testurl.cpp
//
// cl testurl.cpp /W3 /EHsc /MDd /D /Zi /Od /D "WINVER=0x500"
// /D "WIN32" /D "_DEBUG" /D "_WINDOWS"
// /FR /link /debug
//
#include <stdio.h>
#include <windows.h>
#ifdef _DEBUG
#define _CRTDBG_MAP_ALLOC
#include <crtdbg.h>
#endif
#include "url.cpp" // new URL parser
void ParseUrl(const char *str)
{
URL *url = urlparse(str);
printf("- %4s URL: %s\n", url?"GOOD":"BAD", str);
if (url) urlfree(url);
}
void main(char argc, char *argv[])
{
#ifdef _DEBUG
_CrtMemState memstate1;
_CrtMemState memstate2, memdiff;
// Send all reports to STDOUT
_CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );
_CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDOUT );
_CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );
_CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDOUT );
_CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
_CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDOUT );
_CrtMemCheckpoint(&memstate1);
#endif
ParseUrl("/public/test1.php?title=special:123");
ParseUrl("/public/test1.php?title=special/page_name");
ParseUrl("/public/test1.php?title=special:123/page_name");
ParseUrl("/public/test1.php?/title=special:123/page_name");
#ifdef _DEBUG
_CrtMemCheckpoint(&memstate2);
if ( _CrtMemDifference( &memdiff, &memstate1, &memstate2 )) {
printf("***** MEM LEAK *******\n");
_CrtMemDumpStatistics( &memdiff);
_CrtMemDumpAllObjectsSince(&memdiff);
_CrtDumpMemoryLeaks();
}
#endif}
---------------------- CUT HERE --------------------------
Girish wrote:
Hi,
I working in finding out the memory leak in the application which wa=