10101 garbage collector basics a garbage collector

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: the type system, relying on the error-prone pointer casting and pointer arithmetic that is typical of low-level systems programming. While allocators do not require enormous amounts of code, they are subtle and unforgiving. Students familiar with higherlevel languages such as C++ or Java often hit a conceptual wall when they first encounter this style of programming. To help you clear this hurdle, we will work through the implementation of a simple allocator based on an implicit free list with immediate boundary-tag coalescing. General Allocator Design Our allocator uses a model of the memory system provided by the memlib.c package shown in Figure 10.43. The purpose of the model is to allow us to run our allocator without interfering with the existing system-level malloc package. The mem init function models the virtual memory available to the heap as a large, double-word aligned array of bytes. The bytes between mem start brk and mem brk represent allocated virtual memory. The bytes following mem brk represent unallocated virtual memory. The allocator requests additional heap memory by calling the mem sbrk function, which has the same interface as the system’s sbrk function, and the...
View Full Document

This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online