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 is break in c?

995


difference between native and cross compilers

2093


if a is an integer variable, a=5/2; will return a value a) 2.5 b) 3 c) 2 d) 0

1898


Explain what is the advantage of a random access file?

1079


Explain what is page thrashing?

1056


What is extern variable in c with example?

968


Why is c known as a mother language?

1198


What is structure of c program?

1099


What is calloc()?

1040


How can I write a function analogous to scanf?

1118


How does placing some code lines between the comment symbol help in debugging the code?

957


What are the 4 types of organizational structures?

1044


What is structure data type in c?

983


What does calloc stand for?

1102


Explain how do you declare an array that will hold more than 64kb of data?

1406