Distro News

Memray: Memory profiler for Python applications

Key Takeaway

Memray is an open-source memory profiler that tracks allocations in Python code, the interpreter, and native C/C++ extensions.

Summary

Developed by Bloomberg, Memray is a memory profiler designed to help Python developers identify memory leaks and analyze allocation behavior. It provides deep visibility by tracking both pure Python code and native extension modules. The tool supports multi-threaded workloads and generates various reports, including HTML flame graphs.

Technical capabilities of Memray

  • Tracks allocations in Python code, the interpreter, and native C/C++ extensions.
  • Captures full call-stack information instead of using periodic sampling.
  • Supports multi-threaded workloads, including threads from native libraries.
  • Generates HTML flame graphs, HTML tables, and terminal-based summaries.
  • Features an interactive live terminal view for real-time inspection.
  • Provides a Tracker API for instrumenting specific code regions and a pytest integration for memory testing.

Why it matters

Memray assists developers in debugging complex Python applications that rely heavily on compiled native libraries.

Original reference: www.linuxlinks.com →