Welcome to week 8! These two weeks we will be implementing a memory allocator. Malloc and free work together to keep track of the available memory in the heap. We will start with a minimal set of functions, then add some more functions to improve the use of the memory.
The homework will span the next two weeks, and will consist of two main parts. The first is basic functionality, and the second is enhanced functionality. There is a reason you are being given two weeks. We will not expand office hours near the deadline to account for students procrastinating. You need to start early - it's not a ton of code, but it takes a lot of thought to understand what is going on, what you need to do, and how to code it. We have done the design for you, but you need to do the implementation. DO NOT PROCRASTINATE!!!
Memory allocation begins by requesting and receiving a huge chunk of memory from the operating system. The allocator's job is to cut up that memory and pass it out as needed. Then, when free is called, that little chunk is also tracked. More details are in the description.
After many, many mallocs and frees, there ends up being many little chunks of memory that might be contiguous in memory. If a request comes in for a larger amount of memory, it may be necessary to combine those little chunks into a large one for this request. We need to have the ability to merge separate little chunks that are next to each other in memory.