GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Interview Questions  >  Programming  >  C++

 Print  |  
Question:  Deallocation of memory

Answer: When we allocates the memory using malloc() and calloc(), it returns pointer pointing to the base address to the allocated memory. But while freeing the memory we call free(pointer) then

How the operation system knows that how much memory is about to be free.


June 06, 2009 01:17:44 #2
 tewari2312   Member Since: June 2009    Total Comments: 4 

RE: Deallocation of memory
 
Should have used the term compiler rather than OS, when we use these functions a pointer is formed pointing to the location of the base address of the allocated memory and when the value is assigned at the allocated memory an pointer is created implicetly that points to the location of the last address of the allocated memory.
     

 

Back To Question