class and mem use?


[ Follow Ups ] [ Post Followup ] [ CS1704 Discussion WWWBoard ] [ FAQ ]

Posted by hr on July 26, 2000 at 11:39:25:

Hi I asked you this at the end of the class today, but.. I am still unclear about this?

supporse I have a some useless class like following

class blah
{
int a[102400];
};

now, if I declare class blah in a function like
void function1()
{
blah myblah;
//wait till i say ok to exit
}

and exit the function, it seems that the memory stays there. but if i do
void function2()
{
blah * myblah = new blah;
//wait till i say ok to exit
delete myblah;
}

in a different function and exit, memorty gets cleared.

i used Win2k's TaskManager to check the memory useage of my pathetic test program. i thought they both cleared class blah after exitting the function?


Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ CS1704 Discussion WWWBoard ] [ FAQ ]