1011 common memory related bugs in c programs 555

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: rst fit placement policy, the allocator inspects the most recently used blocks first. In this case, freeing a block can be performed in constant time. If boundary tags are used, then coalescing can also be performed in constant time. Another approach is to maintain the list in address order, where the address of each block in the list is less than the address of its successor. In this case, freeing a block requires a linear-time search to locate the 544 31 3 21 0 31 CHAPTER 10. VIRTUAL MEMORY 3 21 0 block size a/f header block size pred (predecessor) a/f header payload succ (successor) old payload padding (optional) block size a/f footer padding (optional) block size a/f footer (a) Allocated block (b) Free block Figure 10.50: Format of heap blocks that use doubly-linked free lists. appropriate predecessor. The trade-off is that address-ordered first fit enjoys better memory utilization than LIFO-ordered first fit, approaching the utilization of best fit. A disadvantage of explicit lists in general is that free...
View Full Document

Ask a homework question - tutors are online