gc.get_threshold()

gc.get_threshold() Return the current collection thresholds as a tuple of (threshold0, threshold1, threshold2).

gc.isenabled()

gc.isenabled() Returns true if automatic collection is enabled.

gc.get_count()

gc.get_count() Return the current collection counts as a tuple of (count0, count1, count2).

gc.get_debug()

gc.get_debug() Return the debugging flags currently set.

gc.get_referents()

gc.get_referents(*objs) Return a list of objects directly referred to by any of the arguments. The referents returned are those objects visited by the arguments’ C-level tp_traverse methods (if any), and may not be all objects actually directly reachable. tp_traverse methods are supported only by objects that support garbage collection, and are only required to visit objects that may be involved in a cycle. So, for example, if an integer is directly reachable from an argument, that integer o

gc.get_objects()

gc.get_objects() Returns a list of all objects tracked by the collector, excluding the list returned.

gc.collect()

gc.collect(generations=2) With no arguments, run a full collection. The optional argument generation may be an integer specifying which generation to collect (from 0 to 2). A ValueError is raised if the generation number is invalid. The number of unreachable objects found is returned. The free lists maintained for a number of built-in types are cleared whenever a full collection or collection of the highest generation (2) is run. Not all items in some free lists may be freed due to the parti

gc.callbacks

gc.callbacks A list of callbacks that will be invoked by the garbage collector before and after collection. The callbacks will be called with two arguments, phase and info. phase can be one of two values: “start”: The garbage collection is about to start. “stop”: The garbage collection has finished. info is a dict providing more information for the callback. The following keys are currently defined: “generation”: The oldest generation being collected. “collected”: When phase is “stop”, the n

gc.garbage

gc.garbage A list of objects which the collector found to be unreachable but could not be freed (uncollectable objects). Starting with Python 3.4, this list should be empty most of the time, except when using instances of C extension types with a non-NULL tp_del slot. If DEBUG_SAVEALL is set, then all unreachable objects will be added to this list rather than freed. Changed in version 3.2: If this list is non-empty at interpreter shutdown, a ResourceWarning is emitted, which is silent by de

gc.enable()

gc.enable() Enable automatic garbage collection.