YanQiben 12.16 2008
YanQiben (072021029@fudan.edu.cn) is the lead person for this assignment.
1 Introduction
In this lab you will be writing a dynamic storage allocator for C programs, i.e., your own version of the malloc, free and realloc routines. You are encouraged to explore the design space creatively and implement an allocator that is correct, efficient and fast.
2 Logistics
You may work in a group of up to one people. Any clarifications and revisions to the assignment will be posted on the course Web page.
3 Hand Out Instructions
Start by copying malloclab-handout.tar to a protected directory in which you plan to do your work. Then give the command: tar xvf malloclab-handout.tar. This will cause a number of files to be unpacked into the directory. The only file you will be modifying and handing in is mm.c. The mdriver.c program is a driver program that allows you to evaluate the performance of your solution. Use the command make to generate the driver code and run it with the command ./mdriver -V. (The -V flag displays helpful summary information.) Looking at the file mm.c you’ll notice a C structure team into which you should insert the requested identifying information about the one individual comprising your programming team. Do this right away so you don’t forget. When you have completed the lab, you will hand in only one file (mm.c), which contains your solution.
1
4 How to Work on the Lab
Your dynamic storage allocator will consist of the following four functions, which are declared in mm.h and defined in mm.c. int mm_init(void); void *mm_malloc(size_t size); void mm_free(void *ptr); void *mm_realloc(void *ptr, size_t size); The mm.c file we have given you implements the simplest but still functionally correct malloc package that we could think of. Using this as a starting place, modify these functions (and possibly define other private static