Click here to Skip to main content
15,909,898 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: saving text in a file? Pin
mpallavi5-Apr-05 21:22
mpallavi5-Apr-05 21:22 
GeneralRe: saving text in a file? Pin
eli150219795-Apr-05 21:27
eli150219795-Apr-05 21:27 
GeneralRe: saving text in a file? Pin
mpallavi5-Apr-05 22:23
mpallavi5-Apr-05 22:23 
GeneralRe: saving text in a file? Pin
Anonymous5-Apr-05 23:13
Anonymous5-Apr-05 23:13 
GeneralRe: saving text in a file? Pin
Anonymous5-Apr-05 23:18
Anonymous5-Apr-05 23:18 
AnswerRe: saving text in a file? Pin
David Crow6-Apr-05 3:39
David Crow6-Apr-05 3:39 
GeneralForm Events Pin
LordTygger5-Apr-05 18:34
LordTygger5-Apr-05 18:34 
GeneralMemory leak Pin
lvantin5-Apr-05 18:22
lvantin5-Apr-05 18:22 
I met a problem relating to use CArray in MFC.

CArray<CMyClass*,CMyClass*> m_pArr;

CMyClass is very simple
Class CMyClass
{
CString m_szName;
CString m_szId;
long m_i4Age;
}

allocate memory:
for (int i=0;i<1000;i++)
{
m_Arr.Add(new CMyClass);
}

destroy memory
for (int i = 0;i<m_Arr.GetSize();i++)
{
CMyClass*p = m_Arr[i];
if (p)
{
delete p;
p = NULL;
}
}
m_Arr.RemoveAll();
m_Arr.FreeExtra();


When I build this code in two mode: debug and release
1. In debug mode, It seems not be leaked
2. In release mode, leak!!! memory is allocates for application never
decrease although i used above code to free the memory. I don't know why there is the difference like that.

Anybody can explain me why? and give me a solution to configure in order to It can run without leak in both mode debug and release.

Thanks a lot
Tin Le,
GeneralRe: Memory leak Pin
Christian Graus5-Apr-05 18:37
protectorChristian Graus5-Apr-05 18:37 
GeneralRe: Memory leak Pin
ThatsAlok5-Apr-05 19:00
ThatsAlok5-Apr-05 19:00 
GeneralRe: Memory leak Pin
S. Senthil Kumar5-Apr-05 22:40
S. Senthil Kumar5-Apr-05 22:40 
GeneralRe: Memory leak Pin
David Crow6-Apr-05 2:04
David Crow6-Apr-05 2:04 
GeneralRe: Memory leak Pin
lvantin7-Apr-05 15:14
lvantin7-Apr-05 15:14 
GeneralRe: Memory leak Pin
David Crow7-Apr-05 16:06
David Crow7-Apr-05 16:06 
GeneralPlease help with serial communication using Visual C++ Pin
Anonymous5-Apr-05 18:18
Anonymous5-Apr-05 18:18 
GeneralListing down available domains programmatically Pin
alex12055-Apr-05 17:40
alex12055-Apr-05 17:40 
GeneralGraphic stuff Pin
LiYS5-Apr-05 15:22
LiYS5-Apr-05 15:22 
GeneralSetItemData, GetItemData Pin
elephantstar5-Apr-05 15:19
elephantstar5-Apr-05 15:19 
GeneralRe: SetItemData, GetItemData Pin
Christian Graus5-Apr-05 16:06
protectorChristian Graus5-Apr-05 16:06 
GeneralRe: SetItemData, GetItemData Pin
DasdaDAS5-Apr-05 21:01
DasdaDAS5-Apr-05 21:01 
GeneralRe: SetItemData, GetItemData Pin
elephantstar6-Apr-05 8:14
elephantstar6-Apr-05 8:14 
GeneralRe: SetItemData, GetItemData Pin
toxcct5-Apr-05 21:54
toxcct5-Apr-05 21:54 
GeneralRe: SetItemData, GetItemData Pin
Michael Dunn6-Apr-05 2:03
sitebuilderMichael Dunn6-Apr-05 2:03 
Generalneed help with a simple MFC question Pin
stuckupfool5-Apr-05 14:20
stuckupfool5-Apr-05 14:20 
GeneralRe: need help on the program data structure Pin
Christian Graus5-Apr-05 13:07
protectorChristian Graus5-Apr-05 13:07 

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.