previous | start | next

Coalesce

 static void *coalesce(void *bp)        
     

Handles the 4 cases that arise depending on whether the two neighbors of the block to be freed are themselves free or allocated.

Frees the block pointed to by bp in constant time and returns a pointer to the free block after it has been merged (coalesced) with surrounding blocks if they were already free.



previous | start | next