A couple garbage collector questions

Jeremy Hylton jeremy at digicool.com
Tue Apr 10 11:52:09 EDT 2001


Hannah,

This would be a mammoth project for Python.  The Python VM performs
reference counting without any compiler support.  The compiler emits
an instruction like DUP_TOP (duplicate object on top of stack).  The
VM incremenents the reference count of the object as part of the
DUP_TOP implementation.

The Python VM instructions are high level and, thus, fairly
expensive.  To get compiler support for managing reference counts,
we'd need to go with a completely different VM that included reference
count operations as part of the instruction set.  The current
per-instruction overhead would dwarf the cost of the ref counts.  So
without a significant redesign, this approach would probably slow down
the interpreter enormously.

The idea seems reasonable, so far as I can tell.  But we have neither
the compiler infrastructure nor the VM support we would need to make
it work.

Jeremy





More information about the Python-list mailing list