Generational Garbage Collectors

Divide heap into generations, typically according to age of objects

  • how long ago was allocated

When the object is collected 2-3 times, promote it from younger to older generation

Newer generation about 1/2 size of old one

Collect young generation frequently, old generational infrequently

Pointers from old to new generation must be treated as roots

  • must remember them in a data structure
  • basic assumption: there are not many of them - can only happen due to mutation

Approaches to store pointers from old to new generation:

  • remembered list: store all updates since last collection
  • rememberred set: mark old object that might have been updated
  • mark entire chunks of memory that were updated and thus may contain pointers to new generation