48 which frees the requested block bp and then merges

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: e the heap as a large array of bytes and a pointer p that initially points to the first byte of the array. To allocate size bytes, malloc would save the current value of p on the stack, increment p by size, and return the old value of p to the caller. Free would simply return to the caller without doing anything. This naive allocator is an extreme point in the design space. Since each malloc and free execute only a handful of instructions, throughput would be extremely good. However, since the allocator never reuses any blocks, memory utilization would be extremely bad. A practical allocator that strikes a better balance between throughput and utilization must consider the following issues: ¯ ¯ ¯ ¯ Free block organization: How do we keep track of free blocks? Placement: How do we choose an appropriate free block in which to place a newly allocated block? Splitting: After we place a newly allocated block in some free block, what do we do with the remainder of the free block? Coalescing: What do we do with a block that has just been freed? Th...
View Full Document

Ask a homework question - tutors are online