A couple garbage collector questions

Neil Schemenauer nas at python.ca
Mon Apr 2 19:37:09 EDT 2001


Douglas Alan wrote:
>   (1) Why does it use the rather unusual algorithm it does, rather
>       than a more typical mark and sweep?  The per-object storage cost
>       for the extra reference count is surely greater than the bit or
>       two required for a typical mark and sweep.

Mark and sweep requires that you find all root pointers.  That's
difficult to do if you want it to be portable and allow for easy
embedding and extension of the language.

>   (2) Why does the algorithm need back-pointers for the object chain?

So that removing objects from the set is O(1).

  Neil




More information about the Python-list mailing list