Introduction | CS 162 HW 4
You will find a simple skeleton in mm_alloc.c. mm_alloc.h defines an interface with three functions: mm_malloc, mm_free, mm_realloc. You will need to implement these functions. Do not change the headers of any of these! The given mm_test.c performs some sanity checks but is not an exhaustive test. We recommend you write some custom tests when testing locally by changing this file. The man pages for malloc and sbrk are excellent resources for this assignment. Note that you must use sbrk to allocate the heap region. You are NOT allowed to call the standard malloc/free/realloc functions. You may want to refer back to the first part of the homework for information on how process memory works. In this part, you will be allocating blocks of memory in the mapped region of the heap and moving the break appropriately using the sbrk syscall. Initially the mapped region of the heap will have a size of 0. A simple memory allocator for the heap can be implemented using a linked list data structure.
Explore this link on the map →