Reading Questions

Remember to submit your answer to this quetion before the next class.

In its simplest form, a memory allocator allocates and de-allocates memory for application; among which the ubiquitous ones are C's malloc and free family. There are a bunch of production quality allocators in widly use. However, writing a memory allocator from scratch is difficult and too much work, for it must take into account of efficienty, security etc. together. As an example, the Doug Lee allocator for GNU glibc consists of more than 6000 lines of C code!

So, for the purpose of studying heap overflow, we wrote a dirty simple allocator, which is based loosely on the algorithm in K&R's C textbook. Though simple, this allocator is expected to fresh your idea on heap management and on what a heap overflow is. Download the allocator here, and answer the 3 questions in file main.c.