Martin Drautzburg wrote:
Just for curiosity: does python use a mark-and-sweep garbage collector
or simple reference counting?
I can't resist: Yes, it does.
In the latter case it would not garbage
collect circular references, right ?
Python uses refcounting for all objects, and a generational collector
for container objects.
For mark-and-sweep, I assume there must be a toplevel Object from
which all other objects can be accessed or they will be GCed (called
"Smalltalk" in Smalltalk). Is there such a thing?
No. There are no gc roots. Instead, there are global lists of all
container objects, sorted by generation. Garbage is what is not
referenced from outside these lists, everything else must be rooted
somewhere (either in a true root, a local variable of some stack
frame, or an older generation)
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list