Martin Drautzburg wrote: > Just for curiosity: does python use a mark-and-sweep garbage collector > or simple reference counting?
python the language doesn't specify this, but I assume you meant the CPython interpreter. both, sort of: it uses reference counting, and a separate "cycle breaking" collector that runs when needed. but unlike an ordinary m&s-collector, python's collector looks for unreachable objects, not reachable 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? nope. instead, the allocator keeps track of container objects that support the GC protocol. non-containers, such as integers and strings, are not tracked. for an overview, see: http://www.arctrix.com/nas/python/gc/ for the details, see Modules/gcmodule.c. other implementations are free to use other GC strategies. Jython, for example, uses the Java GC to handle Jython garbage. </F> -- http://mail.python.org/mailman/listinfo/python-list