CS430 Project 4: Memory Leaks!

Due November 28, by the end of the day

Project Description

There is an implementation of a FAT filesystem in memory placed on isoptera for you. Unfortunately, it has developed a number of memory leaks, which cause quite excessive memory usage. Your task is to fix these leaks, without resorting to storing large items on the stack (everything which is on the heap now should stay there).

Details

The /proc filesystem contains files for each process ID. So for process ID 3434, /proc/3434 is a directory containing information about that process. One of the files is stat. If you enter "cat /proc/1/stat", you'll see some largely-indecipherable information about the init process.
These files can be accessed much more easily using procps. Use of procps has been added to tester.c, so that the memory usage is displayed at a number of points as the program runs. This is intended to give you a hint as to the location of the leaks.
Once all the leaks are fixed, the final memory usage displayed will be 11694080, or close to that. Once you obtain this number, while preserving heap storage of all items presently stored on the heap, and presuming the program still works, you will have finished the project. The number was obtained on multiple 64-bit computers, but has not been tested on 32-bit or non-x86 architecture.
All required files are located in the /tmp directory on isoptera, rather than the class examples directory. Look for the file /tmp/p4start.zip. The unzip command can open it for you. If you receive an error relating to procps when running make, you may need to install libprocps. On the lab machines, you would enter "sudo aptitude install libprocps-dev".
Although not covered in the class, use of code analysis tools is allowed on this (or any other) assignment. valgrind is installed on isoptera.

Turning in the assignment

Pack together anything needed for the assignment into an archive, and upload it here. If the assignment is only one file, you can skip the archive part.