========
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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
memhunt-0.0.1.tar.gz
(14.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
memhunt-0.0.1-py3-none-any.whl
(13.8 kB
view details)
File details
Details for the file memhunt-0.0.1.tar.gz.
File metadata
- Download URL: memhunt-0.0.1.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
901450c6f833655967d4deb6e3a27c0da1efaf44b4bb3f68fad7073202b55329
|
|
| MD5 |
4eddebdb851c28800515fbb8ad1d3bca
|
|
| BLAKE2b-256 |
e8e0a4c90be22eda135fdf47da983375b9ab4eb93715073b52e7f0b15e4a698d
|
File details
Details for the file memhunt-0.0.1-py3-none-any.whl.
File metadata
- Download URL: memhunt-0.0.1-py3-none-any.whl
- Upload date:
- Size: 13.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ba53b0ea456e9a2335dcbe555eab9714c11ed609dbcfff39d4f3fa42b3e97e9
|
|
| MD5 |
9de7580ec8a187018bcbe2658b64c9f3
|
|
| BLAKE2b-256 |
e1051770f91cdf379fc04f56ace34c03ab4c35b89ad80da35f5a1f77252da967
|