Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is a memory leak in structures? How can we rectify that?

Answer Posted / selvaraj

unwanted memory consumed by a program is called memory leak.

Example:

int fact(void)
{
size=melloc(20);
if(size==NULL)
{
return 1;
}
else
{
return 0;
}
}
Explanation:

size=melloc(20);
here the memory reserved
if(size==NULL)
if memory not available
else means memory available return 0
so, throughout the program the size never used but the program reserved the size. this is called memory leak..

to over come this problem in the else part before return 0; add this statement free(s)

Hope you understood. if not u can reach me iamselvam85@gmail.com

Is This Answer Correct ?    13 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are # preprocessor operator in c?

1090


Explain the advantages of using macro in c language?

983


what are the facialities provided by you after the selection of the student.

2237


What does sizeof function do?

1178


What is optimization in c?

986


What is the meaning of ?

1021


What is extern storage class in c?

984


What is difference between %d and %i in c?

1219


What is getch() function?

1043


hi... can anyone help me to make a two-dimensinal arrays in finding the sum of two elements plzzz. thnx a lot...

1902


Write a program to know whether the input number is an armstrong number.

1102


What is else if ladder?

1008


Why are some ANSI/ISO Standard library routines showing up as undefined, even though I've got an ANSI compiler?

1114


Why should I use standard library functions instead of writing my own?

1245


What are the different types of pointers used in c language?

1031