Click here to Skip to main content
14,883,719 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Converting Fortran source to C++ Source Pin
Richard MacCutchan9-Jun-16 3:42
mveRichard MacCutchan9-Jun-16 3:42 
AnswerRe: Converting Fortran source to C++ Source Pin
leon de boer9-Jun-16 4:10
Memberleon de boer9-Jun-16 4:10 
QuestionC++ and Visual Studio help? Error messages etc.. Pin
User 125396568-Jun-16 8:19
MemberUser 125396568-Jun-16 8:19 
SuggestionRe: C++ and Visual Studio help? Error messages etc.. Pin
David Crow8-Jun-16 9:32
MemberDavid Crow8-Jun-16 9:32 
AnswerRe: C++ and Visual Studio help? Error messages etc.. Pin
Richard MacCutchan8-Jun-16 20:53
mveRichard MacCutchan8-Jun-16 20:53 
AnswerRe: C++ and Visual Studio help? Error messages etc.. Pin
leon de boer8-Jun-16 21:57
Memberleon de boer8-Jun-16 21:57 
GeneralRe: C++ and Visual Studio help? Error messages etc.. Pin
Richard MacCutchan8-Jun-16 22:26
mveRichard MacCutchan8-Jun-16 22:26 
QuestionMemory leak in VC++ 6.0 when store lots of objects in CArray,please help me! Pin
lostangels5-Jun-16 4:37
Memberlostangels5-Jun-16 4:37 
1.dev enviroment:VC++ 6.0

2.build program in 'release'

3.store 1000000 simple objects in CArray

4.run the program without debug


After running the code , it's about 85M memory cannot be release on my computer.

Can anyone explain and solve the problem for me? Thanks.

BTW:Because of the legency project code,my dev IDE is not allowed to update to the latest VisualStudio. So i have to solve the problem in VC 6.0 IDE.


#include "afxtempl.h"

long int g_cCount = 0;
long int g_dCount = 0;

class CMyTest
{
public:
CString m_str;


CMyTest()
{
m_str = "test string";

g_cCount++;
}


~CMyTest()
{
g_dCount++;
}

};

typedef CArray<CMyTest,CMyTest&> CArrayTest;



void Test()
{
g_cCount = 0;
g_dCount = 0;

CArrayTest testArray;

int count = 1000000;
for(int i =0;i < count; i++ )
{
CMyTest testObj;
testObj.m_str = "test string";

testArray.Add(testObj);
}

testArray.RemoveAll();
testArray.FreeExtra();
}

void CTestMemDlg::OnOK()
{
Test();

CString strInfo;
strInfo.Format("Object construction: %d destruction: %d \r\n",g_cCount,g_dCount);
AfxMessageBox("finish\r\n"+strInfo);
}
AnswerRe: Memory leak in VC++ 6.0 when store lots of objects in CArray,please help me! Pin
Daniel Pfeffer5-Jun-16 21:39
professionalDaniel Pfeffer5-Jun-16 21:39 
AnswerRe: Memory leak in VC++ 6.0 when store lots of objects in CArray,please help me! Pin
Richard MacCutchan5-Jun-16 22:35
mveRichard MacCutchan5-Jun-16 22:35 
AnswerRe: Memory leak in VC++ 6.0 when store lots of objects in CArray,please help me! Pin
Victor Nijegorodov6-Jun-16 1:17
MemberVictor Nijegorodov6-Jun-16 1:17 
AnswerRe: Memory leak in VC++ 6.0 when store lots of objects in CArray,please help me! Pin
leon de boer6-Jun-16 3:27
Memberleon de boer6-Jun-16 3:27 
QuestionType checking Pin
Rahul Thengadi4-Jun-16 10:26
MemberRahul Thengadi4-Jun-16 10:26 
AnswerRe: Type checking Pin
leon de boer4-Jun-16 21:03
Memberleon de boer4-Jun-16 21:03 
Questionwhat is the difference between definition numeric value 0.0, .0, 0.? Pin
Member 125258022-Jun-16 22:23
MemberMember 125258022-Jun-16 22:23 
AnswerRe: what is the difference between definition numeric value 0.0, .0, 0.? Pin
Richard MacCutchan2-Jun-16 23:40
mveRichard MacCutchan2-Jun-16 23:40 
GeneralRe: what is the difference between definition numeric value 0.0, .0, 0.? Pin
Member 125258023-Jun-16 1:59
MemberMember 125258023-Jun-16 1:59 
GeneralRe: what is the difference between definition numeric value 0.0, .0, 0.? Pin
Jochen Arndt3-Jun-16 2:38
professionalJochen Arndt3-Jun-16 2:38 
GeneralRe: what is the difference between definition numeric value 0.0, .0, 0.? Pin
Richard MacCutchan3-Jun-16 2:42
mveRichard MacCutchan3-Jun-16 2:42 
QuestionSyntax of How to Call a Member Function via a Function Pointer Pin
Bram van Kampen1-Jun-16 14:37
MemberBram van Kampen1-Jun-16 14:37 
AnswerRe: Syntax of How to Call a Member Function via a Function Pointer Pin
Jochen Arndt1-Jun-16 21:09
professionalJochen Arndt1-Jun-16 21:09 
SuggestionRe: Syntax of How to Call a Member Function via a Function Pointer Pin
Richard MacCutchan1-Jun-16 21:09
mveRichard MacCutchan1-Jun-16 21:09 
AnswerRe: Syntax of How to Call a Member Function via a Function Pointer Pin
leon de boer4-Jun-16 5:00
Memberleon de boer4-Jun-16 5:00 
Questionfor project Pin
Member 1255885431-May-16 23:22
MemberMember 1255885431-May-16 23:22 
AnswerRe: for project Pin
CPallini31-May-16 23:33
mveCPallini31-May-16 23:33 

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.