skillfed

objgraph

Draws Python object reference graphs with graphviz

objgraph v3.6.2 1.3M downloads/30d#4,124 on PyPI842
Permissive license MIT Active released

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 objgraph

uv

uv add objgraph

poetry

poetry add objgraph

Installing 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

Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

python memory leak visualizationobject reference graphpython object graph explorermemory profiling graphvizpython garbage collection debugobject reference trackingvisualize python object references
memory-debuggingprofilingvisualization

More Software Development packages