[gclist] some questions about Generational GCs.

Pekka P. Pirinen pekka@harlequin.co.uk
Thu, 25 Mar 99 13:54:20 GMT

> 1) how to implement finalized objects: Some objects need to be
>    explicitly destroyed (ie have their C++ destructor called) by the
>    GC. I'm thinking about using special "generations" for them, and
>    explicitly maintaining a collection grouping them.

That's the way: keep them separate and scan them last.

> 2) In a major GC cycle, can I condemn some (eg half of) the old
>    generations. I believe that yes (with perhaps sometimes potential
>    leak with cycles of old objects...).

You can condemn any collection of objects that you like.  You'll want
to have some efficient way of finding references into the condemned
set from the outside, because if you end up scanning everything, you
might just as well have condemned it.  This is why typical
implementations of generational collection condemn ranges of
generations from the youngest upwards: they keep track of old-to-young
pointers only.  This is not a bad strategy.  For more sophisticated
handling of old objects, look at the Train algorithm:

  author = 	 "Richard L. Hudson and J. Eliot B. Moss",
  title = 	 "Incremental Collection of Mature Objects",
  crossref =  "iwmm92",
  pages = 	 "388--403"
  title = 	 "International Workshop on Memory Management",
  booktitle = 	 "International Workshop on Memory Management",
  year = 	 1992,
  editor = 	 "Yves Bekkers and Jacques Cohen",
  number =       637,
  series = 	 "Lecture Notes in Computer Science",
  publisher = "Springer-Verlag",
  address = 	 "St. Malo, France",
  month = 	 sep