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

i have to apply for rbi before that i need to know the the syllabus for the entrance questions. whethet it may be aps or techinical

2275


What is c method?

940


The % symbol has a special use in a printf statement. How would you place this character as part of the output on the screen?

1221


what is the difference between 123 and 0123 in c?

1155


What is const volatile variable in c?

980


What are the ways to a null pointer can use in c programming language?

1075


Do you know the difference between malloc() and calloc() function?

1003


Explain that why C is procedural?

1081


What is s or c?

1012


What is sizeof return in c?

977


What is data structure in c language?

1054


how to write a c program to print list of fruits in alpabetical order?

2239


Is c a great language, or what?

1049


What are the differences between Structures and Arrays?

1129


When we use void main and int main?

1017