Python GC Module
Garbage collector — collect, get_objects, set_threshold, get_stats. This category documents 13 Python gc module entries, and each page gives you the full syntax, the parameter list, the return value, and a runnable example. The entries include: gc.collect(), gc.get_objects(), gc.set_threshold(), gc.get_threshold(), gc.get_count(), gc.set_debug(), gc.get_stats(), gc.garbage, gc.disable(), gc.enable(), gc.isenabled(), gc.freeze(), gc.unfreeze(). gc.collect() runs the garbage collector. Returns the number of unreachable objects collected. gc.get_objects() returns a list of all objects tracked by the garbage collector. gc.set_threshold() sets the garbage collection thresholds for each generation. gc.get_threshold() returns the current GC thresholds as a tuple. gc.get_count() returns the current collection counts as a tuple. GC Module belongs to the Dev Tools group alongside Inspect Module, Pdb Module, Traceback Module, Timeit Module. You can also search across every category from the search page, browse the complete A–Z index, or try any example in the Python playground.