大家帮我看看为什么这段程序加上afxwin.h的头文件就会出现内存泄漏(gstring类没有问题)
豆球果东 2005-07-19 05:31:21 #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <list>
#include <afxwin.h>
#include <vector>
#include "gstring.h"
using namespace std;
int main(int argc, char* argv[])
{
vector<GString*> m_list;
for(int i=0; i<10 ; i++)
{
GString *pStr= new GString;
// ASSERT(pStr);
*pStr="ppp";
m_list.push_back(pStr);
}
for(vector<GString*>::iterator it=m_list.begin();it != m_list.end(); it++)
{
GString *pStr;
pStr=*it;
// printf("%s\n" ,*pStr );
}
//*
for(vector<GString*>::iterator it1 = m_list.begin();it1 != m_list.end() ; it1++)
{
delete *it1;
*it1=NULL;
//m_list.pop_front();
}
//*/
m_list.clear();
return 0;
}
******************************************************************************
Detected memory leaks!
Dumping objects ->
{44} normal block at 0x00362638, 33 bytes long.
Data: < C > 00 43 00 CD CD CD CD CD CD CD CD CD CD CD CD CD
{43} normal block at 0x003625D0, 40 bytes long.
Data: < |L > 14 7C 4C 10 16 00 00 00 00 00 00 00 00 00 00 00
Object dump complete.
The thread 0xEA0 has exited with code 0 (0x0).