AI engineering glossary · Computing foundations

What is reference counting?

Reference counting: A memory management scheme in which each object tracks how many references point to it, and is freed as soon as that count reaches zero. CPython uses it as its main mechanism, with a separate collector for cyclic references.

Level: advancedTopic: Computing foundations

Reference counting: an example

In Python, sys.getrefcount(x) reports how many references currently point to object x.

Related terms

More Computing foundations terms

Where you learn it

Reference counting is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.