objgraph
Draws Python object reference graphs with graphviz
What it is and what it does
Objgraph is a debugging tool that maps and visualizes the reference relationships between Python objects in memory. It helps developers hunt memory leaks by showing which objects hold references to which other objects, and can generate graphical representations of these relationships using graphviz. The package provides functions to count object types, track object growth over time, find reference chains between objects, and display backreferences—all useful when you need to understand why memory isn't being freed or which objects are keeping others alive.
The package has no runtime dependencies in Python itself, making it lightweight to install. It integrates with graphviz for visualization and optionally with xdot for interactive graph exploration. It supports modern Python versions from 3.7 onward and has been actively maintained since 2009, with recent updates adding support for Python 3.12 and 3.13.
Use it for:
- Identify which objects are holding references to a suspected memory leak in a long-running application.
- Visualize the reference graph between specific objects to understand unexpected memory retention.
- Track object type growth over time to spot gradual memory accumulation during application execution.
- Debug circular references and reference cycles that prevent garbage collection.
- Analyze object relationships in complex Python programs to understand data structure interactions.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Objgraph lets you visualize and explore Python object reference graphs, showing how objects reference each other in memory to help identify memory leaks and understand object relationships.
Yes. Objgraph is a specialized but essential tool for memory debugging in Python. It has no runtime dependencies, is actively maintained, carries a permissive MIT license, and fills a clear niche in memory profiling that general-purpose tools don't address. Install it if you work on long-running Python applications or suspect memory leaks; skip it if you don't do memory debugging.
Install
objgraph on PyPI
pip
pip install objgraphuv
uv add objgraphpoetry
poetry add objgraphInstalling objgraph
Before you install
Low install friction with no runtime dependencies. Actively maintained with recent releases supporting Python 3.13; last commit 2026-07-24 and 842 repository stars indicate ongoing care.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects with minimal obligations.
Quickstart
pip install objgraph
import objgraph
objgraph.show_most_common_types(limit=10)
objgraph.show_refs([obj], filename='refs.png')
Graphviz must be installed separately on your system to generate visual graphs; xdot is optional but recommended for interactive exploration.
Verify before relying
- Whether the package works correctly with all supported Python versions (3.7–3.13) in your specific environment.
- Performance characteristics when analyzing very large object graphs or long-running processes.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 673 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,277,216/month — #4,124 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: objgraph-3.6.2-py3-none-any.whl
Keywords: object, graph, visualization, graphviz, garbage, collection
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
types-objgraphProvides type annotations for the objgraph…
permissive · top 15,000 on PyPI
pyan3Pyan3 performs static analysis on Python source…
copyleft · top 15,000 on PyPI
pygraphvizPyGraphviz provides a Python interface to…
permissive · top 5,000 on PyPI
modulegraphmodulegraph analyzes Python module dependencies…
permissive · top 15,000 on PyPI
graphvizGenerates DOT language source code for graph…
permissive · top 1,000 on PyPI
gprof2dotConverts profiler output from many sources…
copyleft · top 5,000 on PyPI
objectgraphObjectgraph provides a Python class for…
permissive · top 15,000 on PyPI
pydotplusPyDotPlus provides a Python interface to…
permissive · top 15,000 on PyPI
torchvizGenerates visual diagrams of PyTorch neural…
permissive · top 5,000 on PyPI
altgraphaltgraph constructs and analyzes graphs…
permissive · top 5,000 on PyPI