Comment on page
The chunk has two sections - the metadata of the chunk (information about the chunk) and the user data, where the data is actually stored.
sizeis fairly self-explanatory - it's the overall size of the chunk.
Phave special uses.
PREV_INUSEflag, which is
0when the previous adjacent chunk (the chunk ahead) is free.
Pare used for more sophisticated heap attacks, so we won't worry about them just yet.
prev_sizeis set if the previous adjacent chunk is free, as calculated by
P. If it is not, the heap saves space and
prev_sizeis part of the previous chunk's user data. If it is, then
prev_sizestores the size of the previous chunk.
A free chunk looks a bit different:
The first part is the same, but
BKpointers have been added. This is for the purpose of sorting them into bins, which we will come onto soon.