Previous      Up      Previous     Course Home   e-mail

2.3 Generation-Based Collectors

Old versus New Garbage   

In many programs, people have observed that object lifetime tends toward the extreme possibilities.


Generational GC   

Generational collectors take advantage of this behavior by dividing the heap into "generations".


The actual scanning process is a modified mark and sweep. But because relatively few objects are scanned on each pass, the passes are short and the overall cost of GC is low.

To keep the cost of a pass low, we need to avoid scanning the old objects on the heap. The problem is that some of those objects may have pointers to the newer ones. Most generational schemes use traps in the virtual memory system to detect pointers from "old" pages to "new" ones to avoid having to explicitly scan the old area on each pass.

 Previous      Up      Previous     Course Home   e-mail