memory leak?



could somebody help me to look at the following code? I get memory leak
report, but really have no idea what is wrong. I am using visual c++
7.1 and windows XP. Thanks a lot.

#define _CRTDBG_MAP_ALLOC

#include <stdlib.h>
#include <crtdbg.h>


#ifdef _DEBUG
#define DEBUG_CLIENTBLOCK new( _CLIENT_BLOCK, __FILE__, __LINE__)
#else
#define DEBUG_CLIENTBLOCK
#endif // _DEBUG

#ifdef _DEBUG
#define SET_CRT_DEBUG_FIELD(a) \
_CrtSetDbgFlag((a) | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG))
#define CLEAR_CRT_DEBUG_FIELD(a) \
_CrtSetDbgFlag(~(a) & _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG))
#else
#define SET_CRT_DEBUG_FIELD(a) ((void) 0)
#define CLEAR_CRT_DEBUG_FIELD(a) ((void) 0)
#endif

#ifdef _DEBUG
#define DISPLAY_REGION 1
#else
#undef DISPLAY_REGION
#endif


#include "stdafx.h"
#include <crtdbg.h>
#include <string>

int _tmain(int argc, _TCHAR* argv[])
{
using namespace std;
string test("123456789abcdefg");
_CrtMemDumpAllObjectsSince( NULL );
return 0;
}

.



Relevant Pages