This preview shows page 1. Sign up to view the full content.
Unformatted text preview: of the implicit free list. The ﬁrst word is an unused padding word aligned to a double-word boundary. The padding is followed by a special prologue block, which is an eight-byte allocated block consisting of only a header and a footer. The prologue block is created during initialization and is never freed. Following the prologue block are zero or more regular blocks that are created by calls to malloc or free. The heap always ends with a special epilogue block, which is a zero-sized allocated block that consists of only a header. The prologue and epilogue blocks are tricks that eliminate the edge conditions during coalescing. The allocator uses a single private (static) global variable (heap listp) that always points to the prologue block. (As a minor optimization, we could make it point to the next block instead of the prologue block.) Basic Constants and Macros for Manipulating the Free List
Figure 10.45 shows some basic constants that we will use throughout the allocator code. Lines 2–5 deﬁne some basic size constants: the si...
View Full Document