CS430 Project 4: Memory Leaks!
Due Thursday, November 29, by the end of the day
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. It also contains a number of memory bugs, generally invalid reads or writes from a variety of causes. Your task is to fix these leaks and memory errors, without resorting to storing large items on the stack (everything which is on the heap now should stay there).
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 (the exact value will depend on the linux kernel version). 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 or every kernel version.
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 apt install libprocps-dev".
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.