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

Answer Posted / vrushali

Whenever we call malloc() for allocating memory. The value
of the starting address is stored in a virtual memory tables.
So whenever free() is called then using the starting memory
location free () will have an entry of the bytes allocated
and to be freed. It can do it using this entry then entry is
deleted also.
This is pure OS concept.

Please reply here if you are not able to understand my answer.

Is This Answer Correct ?    4 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I read a binary data file properly?

643


What are the features of c language?

633


application attempts to perform an operation?

1504


hi folks i m approching for h1 b interview on monday 8th of august at montreal and i m having little problem in my approval notice abt my bithdate my employer has made a mistake while applying it is 12th january and istead of that he had done 18 the of january do any body have any solution for that if yes how can i prove my visa officer abt my real birthdate it urgent please let me know guys thaks dipesh patel

1425


How is a null pointer different from a dangling pointer?

565






Device an algorithm for weiler-atherton polygon clipping, where the clipping window can be any specified polygon

5472


What is the difference between the = symbol and == symbol?

635


Please send me WIPRO technical question to my mail ID.. its nisha_g28@yahoo.com please its urgent

1668


Explain what are run-time errors?

616


What is the difference between memcpy and memmove?

618


how we can make 3d venturing graphics on outer interface

4032


Explain what is the stack?

653


What is c variable?

567


What is the use of #define preprocessor in c?

627


What are the advantages of Macro over function?

1224