Fence Posts

Fence Posts - beginning of the chunk with the flag set to...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Fence Posts If the object freed is at the beginning of the heap, it is likely that your allocator will try erroneously to coalesce memory beyond the beginning of the heap. Also other libraries may call sbrk() causing a hole in the heap.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Fence Posts To prevent coalescing with memory beyond the beginning or the end of the chunks that belong to the heap your allocator will: every time a chunk of memory is requested from the OS, your allocator has to add a dummy footer at the
Background image of page 2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: beginning of the chunk with the flag set to allocated. Also at the end of the chunk you will add a header with the flag set to allocated. If two chunks are consecutive, you should remove the fence posts between them. Fence Posts Start of Heap Dummy footer (flag=allocated) End of Heap Dummy Header (flag=allocated) Fence Posts Start of Heap Dummy Header (flag=allocated) Heap Hole (other library called sbrk) Dummy Footer (flag=allocated) End of Heap...
View Full Document

Page1 / 4

Fence Posts - beginning of the chunk with the flag set to...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online