Memray: a Memory Profiler for Python
Memray is an open-source memory profiler for Python developed by Bloomberg. It allows developers to track memory allocations in Python code and extensions, offering features like flame graphs, statistical summaries, and real-time memory monitoring to help diagnose memory usage and leaks.
Background
Memray is an open-source memory profiler for Python developed and released by Bloomberg. It tracks memory allocations in Python programs line by line, helping developers find memory leaks, understand memory usage patterns, and optimize performance. Unlike standard Python profilers, Memray can trace allocations made by C extensions and native code (e.g., NumPy, Pandas, Cython). It supports multiple output formats including flame graphs, tree views, and live terminal tracking. The tool works on Linux and macOS, and gained attention as one of the more advanced options in the Python memory profiling ecosystem, which also includes tools like memory_profiler, tracemalloc, and Py-Spy.