Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > Memory Leak det...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 43084 of 47561
Post > Topic >>

Memory Leak detection

by Archana <trialproduct2004@[EMAIL PROTECTED] > Feb 3, 2008 at 11:01 PM

Hi all,

I am new to c++. I have written one c++ application. I want to detect
memory leaks from  my program.

I tried with following code which i got from net.
	if(_CrtDumpMemoryLeaks() == TRUE)  // re****ts no leak

	{
		printf("detected 1");
	}
	 int *foo = new int[4];

    if(_CrtDumpMemoryLeaks() == TRUE)//re****ts a memory leak

	{
		printf("detected 2");
	}
     delete[] foo;
     foo = NULL;
   	if(_CrtDumpMemoryLeaks() == TRUE)// re****ts no leak

	{
		printf("detected 3");
	}



Ideally first time i should not get any memory leak.  But when i run
above code all print statements are executed.

Can anyone tell me why this is happening?

Please correct me if i am wrong.

thanks in advance.
 




 2 Posts in Topic:
Memory Leak detection
Archana <trialproduct2  2008-02-03 23:01:54 
Re: Memory Leak detection
Ian Collins <ian-news@  2008-02-04 20:16:44 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Sep 7 4:19:12 CDT 2008.