[Python-3000] Is reference counting still needed?
Erno Kuusela
erno at iki.fi
Thu Apr 20 09:15:08 CEST 2006
Greg Ewing <greg.ewing at canterbury.ac.nz> writes:
> Edward C. Jones wrote:
>
> > Maybe some day a sufficiently portable automatic garbage collector will
> > be available for C. Until then, we'll have to live with reference counts.
>
> Even if it did become available, we might not want to
> use it. In recent times I've come round to the view that,
> on modern architectures where cacheing is all-important,
> refcounting + cyclic garbage collection may well be
> *better* than mark-and-sweep or some variation thereof.
The refcounting vs generational GC reasoning I've heard argues that
refcounting is less cache-friendly: The cache line containing the
refcount field of the pointed-to objects is dirtied (or at least
loaded) every time something is done with the reference, even when the
object itself is not accessed in any way. Generational GC is said to
make the most frequent gc-related memory references somewhat
localised.
-- erno
More information about the Python-3000
mailing list