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 can I copy just a portion of a string?

1299


what is the function of pragma directive in c?

1105


Why doesnt this code work?

1047


Why do we write return 0 in c?

1040


What is the size of enum in c?

1102


What are the rules for the identifier?

1149


What is the purpose of the preprocessor directive error?

1249


Is c call by value?

1000


Write the syntax and purpose of a switch statement in C.

1087


A variable that is defined in a specified portion of a program but can be used throughout the program a) global variable b) local variable c) character d) none

1220


Explain the ternary tree?

1003


PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE

2006


What is header file in c?

1053


What is array of structure in c programming?

1277


Write a program to check palindrome number in c programming?

999