What should free do?
free this | ||||||||||||||
hd | alloc | ft | hd | free | ft | hd | alloc | ft | hd | alloc | ft | hd | free | ft |
The call to mm_free(ptr) passes a pointer whose value is the beginning address of the alloc area of the block.
The block also contains a header and a footer to keep track of the size of the allocated/free block and possibly more...
How is the size updated and in which header?
What happens to the hd of the block being freed and the ft of the preceding free block?