1. Larry Hastings
  2. python-clinic


python-clinic / Doc / library / gc.rst

:mod:`gc` --- Garbage Collector interface

This module provides an interface to the optional garbage collector. It provides the ability to disable the collector, tune the collection frequency, and set debugging options. It also provides access to unreachable objects that the collector found but cannot free. Since the collector supplements the reference counting already used in Python, you can disable the collector if you are sure your program does not create reference cycles. Automatic collection can be disabled by calling gc.disable(). To debug a leaking program call gc.set_debug(gc.DEBUG_LEAK). Notice that this includes gc.DEBUG_SAVEALL, causing garbage-collected objects to be saved in gc.garbage for inspection.

The :mod:`gc` module provides the following functions:

The following variables are provided for read-only access (you can mutate the values but should not rebind them):

The following constants are provided for use with :func:`set_debug`: