[gclist] Finalizers & Reference counting.

Neel Krishnaswami neelk@alum.mit.edu
Wed, 21 Aug 2002 12:00:52 -0400 (EDT)


Charles Fiterman writes:
> 
> Reference counting has bugs, it can't deal with cyclic data
> structures, it has excessive overhead but it has some striking
> advantages. There are no serious SMP bottlenecks, it never has to
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> stop the world.
  ^^^^^^^^^^^^^^^

I'm *certainly* no expert, but don't you need a lock on every object
to update reference counts atomically? Moreover, modifying an object
in SMP world means that you have to flush the processor's cache to
make sure that every processor can see the changes -- and RC demands
an object modification at every access. Together those seem like they
would impose fairly severe limits on the scalability of SMP RC.

Something like the Doligez-Gonthier algorithm, which gives each thread
its own youngest generation, and collects tenured objects with a
variant of Djikstra's concurrent algorithm, would seem to be a way to
go. And if that doesn't do it, then the only means left is to become a
Real Programmer and preallocate all your data, like God and FORTRAN 77
intended. :)

-- 
Neel Krishnaswami
neelk@alum.mit.edu