PyDocs

Python Runtime Services

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.
get_stats() -- Return list of dictionaries containing per-generation stats.
set_debug() -- Set debugging flags.
get_debug() -- Get debugging flags.
set_threshold() -- Set the collection thresholds.
get_threshold() -- Return the current collection thresholds.
get_objects() -- Return a list of all objects tracked by the collector.
is_tracked() -- Returns true if a given object is tracked.
is_finalized() -- Returns true if a given object has been already finalized.
get_referrers() -- Return the list of objects that refer to an object.
get_referents() -- Return the list of objects that an object refers to.
freeze() -- Freeze all tracked objects and ignore them for future collections.
unfreeze() -- Unfreeze all objects in the permanent generation.
get_freeze_count() -- Return the number of objects in the permanent generation.
Symbols in gc

c

callbacks
A list of callbacks that will be invoked by the garbage collector before and after collection.
collect
Run the garbage collector.

d

DEBUG_COLLECTABLE
Print information on collectable objects found.
DEBUG_LEAK
The debugging flags necessary for the collector to print information about a leaking program (equal to DEBUG_COLLECTABLE | DEBUG_UNCOLLECTABLE | DEBUG_SAVEALL).
DEBUG_SAVEALL
When set, all unreachable objects found will be appended to garbage rather than being freed.
DEBUG_STATS
Print statistics during collection.
DEBUG_UNCOLLECTABLE
Print information of uncollectable objects found (objects which are not reachable but cannot be freed by the collector).
disable
Disable automatic garbage collection.

e

enable
Enable automatic garbage collection.

f

freeze
Freeze all current tracked objects and ignore them for future collections.

g

garbage
A list of objects which the collector found to be unreachable but could not be freed (uncollectable objects).
get_count
Return a three-tuple of the current collection counts.
get_debug
Get the garbage collection debugging flags.
get_freeze_count
Return the number of objects in the permanent generation.
get_objects
Return a list of objects tracked by the collector (excluding the list returned).
get_referents
Return the list of objects that are directly referred to by 'objs'.
get_referrers
Return the list of objects that directly refer to any of 'objs'.
get_stats
Return a list of dictionaries containing per-generation statistics.
get_threshold
Return the current collection thresholds.

i

is_finalized
Returns true if the object has been already finalized by the GC.
is_tracked
Returns true if the object is tracked by the garbage collector.
isenabled
Returns true if automatic garbage collection is enabled.

s

set_debug
Set the garbage collection debugging flags.
set_threshold
Set the collection thresholds (the collection frequency).

u

unfreeze
Unfreeze all objects in the permanent generation.