gc

This module provides access to the garbage collector for reference cycles.

enable() – Enable automatic garbage collection. disable() – Disable automatic garbage collection. isenabled() – Returns true if automatic collection is enabled. collect() – Do a full collection right now. get_count() – Return the current collection counts. set_debug() – Set debugging flags. get_debug() – Get debugging flags. set_threshold() – Set the collection thresholds. get_threshold() – Return the current the collection thresholds. get_objects() – Return a list of all objects tracked by the collector. is_tracked() – Returns true if a given object is tracked. get_referrers() – Return the list of objects that refer to an object. get_referents() – Return the list of objects that an object refers to.

Functions

collect(([generation]) -> n) With no arguments, run a full collection.
disable(() -> None) Disable automatic garbage collection.
enable(() -> None) Enable automatic garbage collection.
get_count() -> (count0, count1, count2) Return the current collection counts
get_debug(() -> flags) Get the garbage collection debugging flags.
get_objects(() -> [...]) Return a list of objects tracked by the collector (excluding the list returned).
get_referents((*objs) -> list) Return the list of objects that are directly referred to by objs.
get_referrers((*objs) -> list) Return the list of objects that directly refer to any of objs.
get_threshold() -> (threshold0, threshold1, ...) Return the current collection thresholds
is_tracked((obj) -> bool) Returns true if the object is tracked by the garbage collector.
isenabled(() -> status) Returns true if automatic garbage collection is enabled.
set_debug((flags) -> None) Set the garbage collection debugging flags.
set_threshold((threshold0, [threshold1, ...) Sets the collection thresholds.