{
    "mode": "pydoc",
    "parameter": "gc",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/pydoc/gc/json",
    "generated": "2026-06-02T15:06:56Z",
    "sections": {
        "NAME": {
            "content": "gc - This module provides access to the garbage collector for reference cycles.\n",
            "subsections": []
        },
        "MODULE REFERENCE": {
            "content": "https://docs.python.org/3.10/library/gc.html\n\nThe following documentation is automatically generated from the Python\nsource files.  It may be incomplete, incorrect or include features that\nare considered implementation detail and may vary between Python\nimplementations.  When in doubt, consult the module reference at the\nlocation listed above.\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "",
            "subsections": [
                {
                    "name": "enable",
                    "content": ""
                },
                {
                    "name": "disable",
                    "content": ""
                },
                {
                    "name": "isenabled",
                    "content": ""
                },
                {
                    "name": "collect",
                    "content": ""
                },
                {
                    "name": "get_count",
                    "content": ""
                },
                {
                    "name": "get_stats",
                    "content": ""
                },
                {
                    "name": "set_debug",
                    "content": ""
                },
                {
                    "name": "get_debug",
                    "content": ""
                },
                {
                    "name": "set_threshold",
                    "content": ""
                },
                {
                    "name": "get_threshold",
                    "content": ""
                },
                {
                    "name": "get_objects",
                    "content": ""
                },
                {
                    "name": "is_tracked",
                    "content": ""
                },
                {
                    "name": "is_finalized",
                    "content": ""
                },
                {
                    "name": "get_referrers",
                    "content": ""
                },
                {
                    "name": "get_referents",
                    "content": ""
                },
                {
                    "name": "freeze",
                    "content": ""
                },
                {
                    "name": "unfreeze",
                    "content": ""
                },
                {
                    "name": "get_freeze_count",
                    "content": ""
                }
            ]
        },
        "FUNCTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "collect",
                    "content": "Run the garbage collector.\n\nWith no arguments, run a full collection.  The optional argument\nmay be an integer specifying which generation to collect.  A ValueError\nis raised if the generation number is invalid.\n\nThe number of unreachable objects is returned.\n"
                },
                {
                    "name": "disable",
                    "content": "Disable automatic garbage collection.\n"
                },
                {
                    "name": "enable",
                    "content": "Enable automatic garbage collection.\n"
                },
                {
                    "name": "freeze",
                    "content": "Freeze all current tracked objects and ignore them for future collections.\n\nThis can be used before a POSIX fork() call to make the gc copy-on-write friendly.\nNote: collection before a POSIX fork() call may free pages for future allocation\nwhich can cause copy-on-write.\n"
                },
                {
                    "name": "get_count",
                    "content": "Return a three-tuple of the current collection counts.\n"
                },
                {
                    "name": "get_debug",
                    "content": "Get the garbage collection debugging flags.\n"
                },
                {
                    "name": "get_freeze_count",
                    "content": "Return the number of objects in the permanent generation.\n"
                },
                {
                    "name": "get_objects",
                    "content": "Return a list of objects tracked by the collector (excluding the list returned).\n\ngeneration\nGeneration to extract the objects from.\n\nIf generation is not None, return only the objects tracked by the collector\nthat are in that generation.\n"
                },
                {
                    "name": "get_referents",
                    "content": "getreferents(*objs) -> list\nReturn the list of objects that are directly referred to by objs.\n"
                },
                {
                    "name": "get_referrers",
                    "content": "getreferrers(*objs) -> list\nReturn the list of objects that directly refer to any of objs.\n"
                },
                {
                    "name": "get_stats",
                    "content": "Return a list of dictionaries containing per-generation statistics.\n"
                },
                {
                    "name": "get_threshold",
                    "content": "Return the current collection thresholds.\n"
                },
                {
                    "name": "is_finalized",
                    "content": "Returns true if the object has been already finalized by the GC.\n"
                },
                {
                    "name": "is_tracked",
                    "content": "Returns true if the object is tracked by the garbage collector.\n\nSimple atomic objects will return false.\n"
                },
                {
                    "name": "isenabled",
                    "content": "Returns true if automatic garbage collection is enabled.\n"
                },
                {
                    "name": "set_debug",
                    "content": "Set the garbage collection debugging flags.\n\nflags\nAn integer that can have the following bits turned on:\nDEBUGSTATS - Print statistics during collection.\nDEBUGCOLLECTABLE - Print collectable objects found.\nDEBUGUNCOLLECTABLE - Print unreachable but uncollectable objects\nfound.\nDEBUGSAVEALL - Save objects to gc.garbage rather than freeing them.\nDEBUGLEAK - Debug leaking programs (everything but STATS).\n\nDebugging information is written to sys.stderr.\n"
                },
                {
                    "name": "set_threshold",
                    "content": "setthreshold(threshold0, [threshold1, threshold2]) -> None\n\nSets the collection thresholds.  Setting threshold0 to zero disables\ncollection.\n"
                },
                {
                    "name": "unfreeze",
                    "content": "Unfreeze all objects in the permanent generation.\n\nPut all objects in the permanent generation back into oldest generation.\n"
                }
            ]
        },
        "DATA": {
            "content": "DEBUGCOLLECTABLE = 2\nDEBUGLEAK = 38\nDEBUGSAVEALL = 32\nDEBUGSTATS = 1\nDEBUGUNCOLLECTABLE = 4\ncallbacks = []\ngarbage = []\n",
            "subsections": []
        },
        "FILE": {
            "content": "(built-in)\n\n",
            "subsections": []
        }
    },
    "summary": "gc - This module provides access to the garbage collector for reference cycles.",
    "flags": [],
    "examples": [],
    "see_also": [],
    "tldr": {
        "source": "official",
        "description": "Count nodes, edges, connected components, or clusters in Graphviz `.dot` files.",
        "examples": [
            {
                "description": "Count nodes and edges in a file",
                "command": "gc {{path/to/file.dot}}"
            },
            {
                "description": "Count only [n]odes",
                "command": "gc -n {{path/to/file.dot}}"
            },
            {
                "description": "Count only [e]dges",
                "command": "gc -e {{path/to/file.dot}}"
            },
            {
                "description": "Count [c]onnected components",
                "command": "gc -c {{path/to/file.dot}}"
            },
            {
                "description": "Display help",
                "command": "gc -?"
            }
        ]
    }
}