Lab 6 requires you to fill in the heapWalk function of a skeleton program that allocates blocks into the heap. We will diagram on the board exactly what the starter program Lab6.c does, how it allocates blocks into the heap and how the blocks are encoded. Once you see the block structure and encoding you will be able to walk the heap, recognize each block and print out a line of info for each block found.
This Lab6 program has no legitimate allocation scheme. It imitates a stack by satisfying every call to malloc with a new block appended to the top of the heap. Every call to malloc grows the heap by one block. This is very inefficient. We give you a working free() function that correctly marks a block as being FREE, but it is of no real value to the program because the allocation scheme does not know how to find those freed blocks in order to re-use them. Once you understand how to find the blocks and decode them, you are ready to implement a real allocation scheme that looks for free blocks to satisfy new calls to malloc instead of just wastefully allocating new space at the end of the heap for every call to malloc.
Any time you free a block you should always look at the block after and the block before you. If either of those blocks are free you should combine them to make a single bigger block.