gc

Stdlib — IntrospectionPython 2.0+Expert

Garbage collector interface: enable/disable, find reference cycles

Quick Info

Documentation
Official Docs
Python Version
2.0+
Dependencies
None — Python Standard Library
Install
Included with Python

Learn by Difficulty

Quick Example

python
import gc

print(f"GC enabled: {gc.isenabled()}")
print(f"Thresholds: {gc.get_threshold()}")
collected = gc.collect()
print(f"Collected: {collected} objects")

The gc module is part of Python's standard library. Garbage collector interface: enable/disable, find reference cycles.

Try in Playground

Tags

stdlibmemorygarbage-collectioninternals

Related Items