--- id: memory-profiler version: "0.61.0" license: BSD license_treatment: permissive maintenance: dormant --- # memory-profiler — A module for monitoring memory usage of a python program License: permissive · Maintenance: dormant · Downloads: 8.2M/mo ## What it is and what it does Memory Profiler is a Python module for analyzing memory consumption at both the process level and the line-by-line level within functions. It provides two main modes: line-by-line profiling (via the @profile decorator or -m memory_profiler flag) that shows memory usage and increments for each line of code, and time-based profiling (via the mprof command-line tool) that records overall memory usage over time and can generate plots. It depends on psutil for system-level memory monitoring. The package is designed for developers and researchers who need to understand where memory is being allocated and freed in their Python programs. It can track multiprocessing contexts, plot memory trends, and identify potential memory leaks. However, the package is no longer actively maintained, meaning bug fixes and compatibility updates are unlikely to be forthcoming. Use it for: - Identify which lines of code in a function consume the most memory by decorating with @profile and running with -m memory_profiler. - Track overall memory usage of a long-running Python script over time using mprof run and mprof plot to visualize trends. - Detect memory leaks by monitoring whether memory usage grows unexpectedly during process execution. - Profile multiprocessing applications to see memory consumption of parent and child processes separately or combined. - Generate memory usage reports with plots for performance analysis and documentation. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Profiles memory consumption line-by-line in Python functions and tracks overall process memory usage over time using the psutil module. Yes, with caution. The package is stable and widely used (top 5000 PyPI), has low install friction, and carries no known vulnerabilities. However, it is dormant with no active maintenance. Install it if you need line-by-line memory profiling and can accept that bugs or compatibility issues will not be fixed by the maintainer. Consider it a mature, read-only tool rather than an actively developed project. ## Install pip install memory-profiler uv add memory-profiler poetry add memory-profiler ## Installing memory-profiler Before you install: Low install friction with a single runtime dependency (psutil). However, the package is dormant—last release was 2022-11-15 and the maintainer has stated it is no longer actively maintained and issues will not be actively addressed. License in practice: BSD license (permissive) allows use in most projects without significant restriction, though you should review the specific BSD terms if proprietary use is involved. Quickstart: pip install memory-profiler from memory_profiler import profile @profile def my_func(): a = [1] * (10 ** 6) return a if __name__ == '__main__': my_func() # Run with: python -m memory_profiler script.py Requires Python 3.5 or later; psutil must be installed as a runtime dependency. Verify before relying: - Whether the package works reliably with recent Python versions given the dormant maintenance status. - Current compatibility with modern versions of psutil and any plotting dependencies. - Whether multiprocessing and child-process tracking features remain functional in current environments. ## Package facts - License: BSD (permissive) - Python support: supports_current - Install friction: low - Maintenance: dormant - Downloads: 8.2M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags memory profiling python, line-by-line memory analysis, process memory monitoring, memory usage tracking, python memory leak detection, memory consumption profiler, mprof memory analysis, profiling, memory-analysis, debugging [View on SkillFed](https://skillfed.io/packages/memory-profiler) · [View on PyPI](https://pypi.org/project/memory-profiler/)