Dynamic Memory Allocation

November 1, 2012

During an Operating Systems module at the University of Southampton, I teamed up with a friend to create implementations of the C memory management functions free() and malloc().

You are asked to write replacements in the C programming language, conforming to the C99 standard, for the standard calls malloc() and free(). The performance of your replacements will be explored using a set of automated tests and marks will be allocated accordingly.

A good friend, Jamie Davies, and I partnered up and together we explored a number of memory management techniques and algorithms.

What made the coursework interesting was that marks were being awarded based on how well a solution ranked amongst all others in the class (with a solution being judged on speed and efficiency). Jamie and I knew it would be difficult to be the best at both speed and efficiency, so we decided to focus our efforts on making our solution as efficient as possible and would later attempt to optimise it.

After six iterations, we had learnt enough to code something which we thought could rank highly amongst our peers. This included using a singly-linked list to allow for faster traversal of free blocks in memory and ensuring that adjacent free blocks were coalesced when freed.

Jamie and I managed to rank top in the class by having the best combination of the marking criteria. This resulted in each of us being awarded 99100 for the coursework!

The project was also being judged on the frequency and quality of commits to the SVN repository we had to use to version control our code. Since then I have converted the code to a git repo and hosted it on GitHub. The README provides more details on our final solution.

Repository Link: https://github.com/eskriett/os_malloc
Languages: C
Collaborated with: Jamie Davies