Re: GC strategies

Date view Thread view Subject view Author view

From: Alexandre Oliva (oliva@dcc.unicamp.br)
Date: Sat Oct 31 1998 - 06:40:28 EST


On Oct 30, 1998, Archie Cobbs <archie@whistle.com> wrote:

> We'd add pseudo-reference counts to each object. The pseudo-reference
> count would have the property that it was equal to or greater than
> the actual reference count.

I don't think you'd be able to ensure that this holds, if two new
references are created for the same object concurrently, on a
multiprocessed system :-(

Furthermore, I have always been told that reference counting doesn't
get you a good garbage collector, because creating and destroying
references ends up too expensive, especially if you need
synchronization. However, since we need write barriers anyway, it
might be worth a try.

There's another issue that has to do with locality. If you have to
access an object every time you create a reference to it, you're
probably increasing the number of cache misses, and occupying cache
lines with data that did not have to be there. Of course, you can
physically separate the reference counter from the object data, but
I'm not sure this really solves the problem.

The most efficient implementations of garbage collection heavily
exploit locality of reference, I was told. But I don't understand how
this can be made to work with mark and sweep.

> This would mainly benefit code that uses a lot of transient local
> variables, for example..

That's the point of using generational garbage collectors. Transient
objects are collected more often than aged objects. However, whenever
an aged object is modified so as to point to a young one, the young is
aged, so as to prevent it from being collected in the set of young
ones.

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:oliva@gnu.org mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 19:57:02 EDT