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

Where define directive used?

611


Is c procedural or object oriented?

585


Write a C program to count the number of email on text

1422


a formula,a series of steps,or well defined set of rules for solving a problem a) algorithem b) program c) erdiagram d) compiler

618


1. Write a function to display the sum of two numbers in the following ways: By using (i) pass by value (ii) pass by address a. function with argument and with return value b. function with argument and without return value c. without argument , with return value d. without argument , without return value Note: Use pass by address.

2339






write a program to print data of 5 five students with structures?

1612


What is function in c with example?

635


What is meant by realloc()?

682


What is the process of writing the null pointer?

611


How can you find the exact size of a data type in c?

603


What are the types of assignment statements?

633


Explain what is wrong with this program statement?

626


Is it cc or c in a letter?

574


How can I open a file so that other programs can update it at the same time?

665


What are Macros? What are its advantages and disadvantages?

651