Skip to main content
========
memhunt
========

memhunt is a modern Python memory debugging and profiling toolkit, originally based on z3c.memhunt.objgraph.
This package has been completely modernized to work with Python 3.8+ and is now framework-agnostic.

memhunt uses objgraph and pympler to help locate and diagnose memory leaks in Python applications.
It provides both web-based interfaces (using Jinja2 templates) and programmatic APIs for memory analysis.

Features
--------

* Memory usage analysis and reporting
* Object reference counting and visualization
* Memory leak detection
* Reference graph generation (requires graphviz)
* Framework-agnostic (works with any Python application)
* FastAPI integration example
* Modern Jinja2 templates for web interfaces
* Comprehensive test suite

Installation
------------

Install memhunt using pip:

pip install memhunt

For FastAPI integration:

pip install memhunt[fastapi]

For development:

pip install memhunt[dev]

Quick Start
-----------

Basic memory analysis:

from memhunt.browser.views import DebugView

debug = DebugView()
print(debug.memory()) # Print memory summary
print(debug.get_biggest_offender()) # Find biggest memory consumer

Web interface example with FastAPI:

from fastapi import FastAPI
from memhunt.browser.views import Start, DebugView

app = FastAPI()

@app.get("/memhunt/")
def memory_debug():
view = Start()
return view()

@app.get("/memhunt/memory")
def memory_summary():
debug = DebugView()
return {"memory": debug.memory()}

Requirements
------------

* Python 3.8+
* pympler>=0.9
* objgraph>=3.5.0
* jinja2>=3.0.0

For graphical output (optional):
* graphviz

Testing
-------

Run tests:

pytest tests/

With coverage:

pytest tests/ --cov=memhunt --cov-report=term-missing

License
-------

This package is licensed under the Zope Public License (ZPL) 2.1.

Release files for memhunt 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for memhunt 0.0.1
File Size Uploaded
memhunt-0.0.1.tar.gz 14.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for memhunt 0.0.1
File Interpreter ABI Platform
memhunt-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 28.3 kB

Release files / memhunt-0.0.1.tar.gz

Download URL memhunt-0.0.1.tar.gz
Size 14.5 kB
Tags Source
SHA-256 checksum
How to use checksums
901450c6f833655967d4deb6e3a27c0da1efaf44b4bb3f68fad7073202b55329
BLAKE2b-256 checksum
How to use checksums
e8e0a4c90be22eda135fdf47da983375b9ab4eb93715073b52e7f0b15e4a698d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Release files / memhunt-0.0.1-py3-none-any.whl

Download URL memhunt-0.0.1-py3-none-any.whl
Size 13.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2ba53b0ea456e9a2335dcbe555eab9714c11ed609dbcfff39d4f3fa42b3e97e9
BLAKE2b-256 checksum
How to use checksums
e1051770f91cdf379fc04f56ace34c03ab4c35b89ad80da35f5a1f77252da967
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page