1 traditional view of a process if we rearrange the

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: servative collector for C programs into an existing malloc package, as shown in Figure 10.52. dynamic storage allocator C application program malloc() conservative garbage collector free() Figure 10.52: Integrating a conservative garbage collector and a C malloc package. The application calls malloc in the usual manner whenever it needs heap space. If malloc is unable to find a free block that fits, then it calls the garbage collector in hopes of reclaiming some garbage to the free list. The collector identifies the garbage blocks and returns them to the heap by calling the free function. The key idea is that the collector calls free instead of the application. When the call to the collector returns, malloc tries again to find a free block that fits. If that fails, then it can ask the operating system for additional memory. Eventually malloc returns a pointer to the requested block (if successful) or the NULL pointer (if unsuccessful). 10.10.2 Mark&Sweep Garbage Collectors A Mark&Sweep garbage coll...
View Full Document

Ask a homework question - tutors are online