Garbage collection versus reference counting

Panu A. Kalliokoski panu at ws23.pca.fi
Mon Jun 26 08:56:49 EDT 2000


I read the python FAQ at www.python.org and came across the question about
implementing automatic storage reclaim in python via garbage collection
instead of reference counting. The most important argument against
garbage collection was code that depends on reference-counting-based
cleanup actions.

This seems quite weird to me, as garbage collection and reference counting
by no means make it impossible to use the other. Is there something wrong
with the approach that both reference counting and garbage collection
are kept, and garbage collection is used for the objects that do not get
collected otherwise? Better still, all memory management could be left
for (generational) garbage collection, but other resources such as file
handles would be cleaned up by reference counting (or gc if that fails).

Is there something I've missed here?




More information about the Python-list mailing list