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...

How does free() know how many bytes to free?

Answer Posted / vadivel t

Heap memory menager is a person, who is responsible for
dynamic memory allocation. He will maintains a internal
data structure(table) to update the information on free and
allocated memory pools. when memory is allocated using
malloc or calloc, the heap memory manager will update the
table(which tells, no of bytes allocated to a particular
pointer) and returns the base address to the application.
when application calls free() with the pointer to be freed
as a argument, free will look into the table which holds no
of bytes allocated for that pointer. And it will free those
many bytes from the base address. Again the freed memory
shall be added to a free memory pool so that other fellows
who needs memory can utilise it.

Is This Answer Correct ?    6 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How is a macro different from a function?

1113


Differentiate between declaring a variable and defining a variable?

994


in iso what are the common technological language?

2047


What is the use of a semicolon (;) at the end of every program statement?

1410


how many errors in c explain deply

2035


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

937


What are the different types of control structures in programming?

1080


What is the time and space complexities of merge sort and when is it preferred over quick sort?

1009


how could explain about job profile

1856


What is a newline escape sequence?

1051


Explain what is #line used for?

1009


What is double pointer in c?

983


Can you write a programmer for FACTORIAL using recursion?

983


Who developed c language?

1036


What does != Mean in c?

986