in reply to RE: RE: What's Wrong With Reference Counting?
in thread What's Wrong With Perl?

Taking a trip into the memory basement, I came up with the Dr. Dobb's Journal for April 2000, where Joshua W. Burton discusses "various" GC algorithms and implementations. That article also references a DDJ Dec. 1997 article by Mike Spertus. Joshua is/was a software engineer at Geodesic Systems (the makers of Great Circle AFAIK).

The focus of the article is on incremental garbage collectors with low latency, as latency is the biggest problem faced by GC nowadays. In terms of raw speed, an atomic collector (like "mark and sweep", where in one pass, all unreferenced memory is marked, and in the second pass, all marked memory is released for recycling) will always be the fastest, but on the other side, you have the latency problem, that for example "mark and sweep" will always take a certain amount of time.

An implementation that suggests low latency is Reference Counting, but even here you (can) have cascades of memory releases, pushing up the latency.

The article then moves on to describe a coloring collector, which colors memory into three categories (for any given moment) :

A collection begins with the root set gray and everything else white. The collection is finished when there is no more grey stuff left. Everything that remains white at the end of collection is garbage and can be released whenever the collector wants. The collector maintains a list of scanned pages and tracks all writes to it (a write to a scanned grey or black page makes rescanning that page necessary). This algorithm can also be interrupted without having to start from the beginning, if you have a mechanism (like CPU-level page locking) to be notified when a write to a scanned page occurs.

  • Comment on (Corion) Other Garbage Collectors than Mark and Sweep