# Garbage Collector

say it: **“GAR-bij kuh-LEK-ter”** **/ˈɡɑːrbɪdʒ kəˈlɛktər/**

Frees memory reference counting misses, like objects pointing only at each other.

## What is the **garbage collector**?

The **garbage collector** frees memory that reference counting misses, such as two objects that point only at each other and are otherwise forgotten.

```python
import gc

class Node:
    pass

a, b = Node(), Node()
a.partner, b.partner = b, a   # they point at each other
del a, b
print(gc.collect())            # frees them, returns how many it cleaned up
```

Level: Master · [More Python terms at this level](https://www.ask-codey.com/glossary?category=python&level=5)

Updated: November 17, 2026

Source: https://www.ask-codey.com/glossary/garbage-collector
