Question about garbage collection

Neil Schemenauer nascheme at news.cnri.reston.va.us
Thu Aug 3 09:40:44 EDT 2000


Donn Cave <donn at oz.net> wrote:
>I'd like to be able to invoke collection in a Python statement
>(one iteration at a time.)

Compile Python with the configure option "--with-cycle-gc".
Then:

    import gc
    gc.set_threshold(0)
    while some condition:
        do something
        gc.collect()

will do want you want.  Currently collect() always does a full
collection.  There should probably be an option to do an
incremental collection.

  Neil



More information about the Python-list mailing list