Click here to Skip to main content
15,887,683 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: create a process from a process and have it not in the same security context Pin
norish3-Jun-09 15:57
norish3-Jun-09 15:57 
AnswerRe: create a process from a process and have it not in the same security context Pin
cefarix3-Jun-09 17:53
cefarix3-Jun-09 17:53 
QuestionHow the output? Pin
Gjm3-Jun-09 12:41
Gjm3-Jun-09 12:41 
AnswerRe: How the output? Pin
Stuart Dootson3-Jun-09 12:48
professionalStuart Dootson3-Jun-09 12:48 
QuestionMFC Socket Pin
reddy073-Jun-09 10:16
reddy073-Jun-09 10:16 
QuestionRe: MFC Socket Pin
David Crow3-Jun-09 11:01
David Crow3-Jun-09 11:01 
AnswerRe: MFC Socket Pin
reddy073-Jun-09 12:06
reddy073-Jun-09 12:06 
QuestionHuge memory leak C++ C Program. [modified] Pin
jobin0070073-Jun-09 9:50
jobin0070073-Jun-09 9:50 
Hi.

I have a program which is creating a huge memory leak. Here is an example of my program. This is not an actual code but an example which references my program.

Class ABC
{

static int *B;
}

Class DEF{
int *MALLOC_C[20];
void Function1(int* ptr);
void Function2( );

}
ABC[10];
DEF[10];

void main()
{
int *sample=new sample();
*sample=1;
ABC* Object1[20];
DEF* Object2[20];
for(int i=0;i<20;i++) //Edited
{
Object1[i]=new ABC();
Object2[i]=new DEF();
}

for(int i=0;i<20;i++)
{
Object[i].Function1(sample);
}


for(int i=0;i<20;i++)
{
delete Object1[i];
delete Object2[i];
}


}

DEF::Function1(int *ptr)
{
ABC::B=ptr;
}
DEF::Function2()
{
for(int i=0;i<20;i++)
{MALLOC_C[i]=(int*) malloc(1000*sizeof(int) ); //Edited,Corrected
}
//DO processing on MALLOC_C

for(int i=0;i<20;i++)
free(MALLOC_c[i]);

}

This is what I am doing. What is wrong? Please help!

modified on Wednesday, June 3, 2009 10:08 PM

AnswerRe: Huge memory leak C++ C Program. Pin
Luc Pattyn3-Jun-09 10:53
sitebuilderLuc Pattyn3-Jun-09 10:53 
GeneralRe: Huge memory leak C++ C Program. Pin
jobin0070073-Jun-09 12:07
jobin0070073-Jun-09 12:07 
GeneralRe: Huge memory leak C++ C Program. Pin
norish3-Jun-09 15:32
norish3-Jun-09 15:32 
AnswerSolved: Huge memory leak C++ C Program. Pin
jobin0070073-Jun-09 16:11
jobin0070073-Jun-09 16:11 
Questionthe Prompt save message Pin
susanne13-Jun-09 4:56
susanne13-Jun-09 4:56 
QuestionRe: the Prompt save message Pin
David Crow3-Jun-09 4:58
David Crow3-Jun-09 4:58 
AnswerRe: the Prompt save message Pin
susanne14-Jun-09 0:55
susanne14-Jun-09 0:55 
GeneralRe: the Prompt save message Pin
susanne14-Jun-09 1:00
susanne14-Jun-09 1:00 
GeneralRe: the Prompt save message Pin
David Crow4-Jun-09 5:47
David Crow4-Jun-09 5:47 
QuestionRestart Manager Using VS2005 MFC Pin
Member 41040373-Jun-09 4:44
Member 41040373-Jun-09 4:44 
AnswerRe: Restart Manager Using VS2005 MFC Pin
Stuart Dootson3-Jun-09 9:08
professionalStuart Dootson3-Jun-09 9:08 
QuestionDEBUG to RELEASE Pin
eli150219793-Jun-09 4:35
eli150219793-Jun-09 4:35 
QuestionRe: DEBUG to RELEASE Pin
David Crow3-Jun-09 5:00
David Crow3-Jun-09 5:00 
AnswerRe: DEBUG to RELEASE Pin
eli150219793-Jun-09 18:25
eli150219793-Jun-09 18:25 
AnswerRe: DEBUG to RELEASE - SOLVED!!!! Pin
eli150219793-Jun-09 19:29
eli150219793-Jun-09 19:29 
GeneralRe: DEBUG to RELEASE - SOLVED!!!! Pin
hyperpontia14-Apr-11 2:01
hyperpontia14-Apr-11 2:01 
GeneralRe: DEBUG to RELEASE - SOLVED!!!! Pin
JackyGee24-Oct-11 23:12
JackyGee24-Oct-11 23:12 

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.