Interview Questions and Answers :: Cisco
Home > Experience Archives > Cisco > Interview Question Set 1 > Discussion
4. When we do malloc we use to give size how much allocation we needed, but at time of freeing we done give, how it know how much it has to free.
Answer:
When memory allocation is done, the actual heap space allocated is one word larger than the requested memory. The extra word is used to store the size of the allocation and is later used by free( )
Amit Singh
25 Aug, 2016 1:36 PM
When memory allocation is done, the actual heap space allocated is one word larger than the requested memory. The extra word is used to store the size of the allocation and is later used by free( )
Report Error
Report Error
Please Login First Click Here