Click here to Skip to main content
15,894,343 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Get number of days used Pin
Ganesh_T12-Jul-06 19:19
Ganesh_T12-Jul-06 19:19 
AnswerRe: Get number of days used Pin
*Dreamz12-Jul-06 19:28
*Dreamz12-Jul-06 19:28 
QuestionPlay a movie clip Pin
see me12-Jul-06 18:00
see me12-Jul-06 18:00 
GeneralRe: Play a movie clip Pin
voorugonda prashanth12-Jul-06 18:10
voorugonda prashanth12-Jul-06 18:10 
AnswerRe: Play a movie clip Pin
Naveen12-Jul-06 18:19
Naveen12-Jul-06 18:19 
GeneralRe: Play a movie clip Pin
see me12-Jul-06 18:31
see me12-Jul-06 18:31 
AnswerRe: Play a movie clip Pin
A_Fa12-Jul-06 19:35
A_Fa12-Jul-06 19:35 
GeneralRe: Play a movie clip Pin
see me12-Jul-06 20:11
see me12-Jul-06 20:11 
AnswerRe: Play a movie clip Pin
Hamid_RT12-Jul-06 20:00
Hamid_RT12-Jul-06 20:00 
GeneralRe: Play a movie clip Pin
see me12-Jul-06 20:06
see me12-Jul-06 20:06 
GeneralRe: Play a movie clip Pin
Hamid_RT12-Jul-06 20:10
Hamid_RT12-Jul-06 20:10 
Questionmodulus operator Pin
thathvamsi12-Jul-06 16:25
thathvamsi12-Jul-06 16:25 
AnswerRe: modulus operator Pin
nguyenvhn12-Jul-06 17:29
nguyenvhn12-Jul-06 17:29 
GeneralRe: modulus operator Pin
thathvamsi12-Jul-06 17:36
thathvamsi12-Jul-06 17:36 
AnswerRe: modulus operator Pin
Naveen12-Jul-06 17:41
Naveen12-Jul-06 17:41 
GeneralRe: modulus operator Pin
thathvamsi12-Jul-06 18:06
thathvamsi12-Jul-06 18:06 
GeneralRe: modulus operator Pin
Naveen12-Jul-06 18:17
Naveen12-Jul-06 18:17 
Questionhelp useing Microsoft HTML Object Library in visual c++ 6 Pin
method00712-Jul-06 12:14
method00712-Jul-06 12:14 
AnswerRe: help useing Microsoft HTML Object Library in visual c++ 6 Pin
nguyenvhn12-Jul-06 17:32
nguyenvhn12-Jul-06 17:32 
GeneralRe: help useing Microsoft HTML Object Library in visual c++ 6 Pin
method00712-Jul-06 17:47
method00712-Jul-06 17:47 
QuestionC++ memory question Pin
mdexch12-Jul-06 11:59
mdexch12-Jul-06 11:59 
The following program doesn't free all the memory. Can any one tell me what is wrong with the code?

Thanks.

//
wchar_t *pwcTest = L"Test";
int g_I=1000;
void AllocateMem(wchar_t ***pwcArray)
{
*pwcArray = (wchar_t**)new wchar_t*[g_I+1];
ZeroMemory(*pwcArray, sizeof(wchar_t*)*g_I+1);
for(int i=0; i<g_I; i++) {
(*pwcArray)[i] = (wchar_t*)new wchar_t[wcslen(pwcTest)+1];
wcscpy((*pwcArray)[i], pwcTest);
}
(*pwcArray)[i] = NULL;
}

void FreeArray(wchar_t **pwcDC)
{
if(pwcDC != NULL) {
for(int i=0; pwcDC[i] != NULL; i++)
delete [] pwcDC[i];
delete [] pwcDC;
}
}

int main( int argc, char *argv[ ])
{
char s[2];

printf("main:\n");
fscanf(stdin, "%s", s);
// Mem Usage (in the Windows Task Manager): 632K

wchar_t **pwcArray = NULL;

for (int i=0; i<1000; i++) {
AllocateMem(&pwcArray);
FreeArray(pwcArray);
}
printf("main: %d\n", i);
fscanf(stdin, "%s", s);
// Mem Usage: 688K (g_I=1000)
// Mem Usage: 908K (g_I=10000)

return 0;
}
//

mdexch
AnswerRe: C++ memory question [modified] Pin
earl12-Jul-06 13:11
earl12-Jul-06 13:11 
GeneralRe: C++ memory question Pin
mdexch14-Jul-06 7:58
mdexch14-Jul-06 7:58 
AnswerRe: C++ memory question Pin
Joe Woodbury12-Jul-06 14:11
professionalJoe Woodbury12-Jul-06 14:11 
GeneralRe: C++ memory question Pin
kanduripavan12-Jul-06 20:46
kanduripavan12-Jul-06 20:46 

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.