Pseudocode jmalloc

Written by Maria Hernandez Rivero, March, 2024

NOTE: Whenever you need to add a specific number of bytes to a memory address pointing to a Chunk struct, you should cast this memory address to either void* or char*. This ensures that, during pointer arithmetic, the operation adds bytes rather than bytes * sizeof(Chunk). While you cannot dereference a void* pointer, performing pointer arithmetic on it treats each increment as a one-byte move.

Compiling mymalloc.c

The gradescript for jmalloc compiles mymalloc.c along with a test file named test.c (which is copied from the Gradescript-Examples directory depending on the problem number provided to the script). This compilation step produces an executable named a.out by default, as no output file name is specified in the gcc command. If the compilation is successful, the script runs a.out and captures its standard output and standard error into temporary files for analysis. The test file (corresponding to a specific problem number from the Gradescript-Examples directory) is designed to test the functionality implemented in mymalloc.c for the given problem number. In other words, you don't need to use a makefile to compile your program. Just ./gradeall or ./gradescript number, but make sure that your mymalloc.c file is in the same directory as the gradescript file.

Variable and Struct

Functions:

1. Traverse function:

2. Function to insert a node in the free list:

3. my_malloc():

4. Function to delete node:

5. my_free():

6. Coalesce_free_list():