What is Memray?

Memray is a free and open source memory profiler for Python. Developed and maintained by Bloomberg, Memray can track memory allocations in Python code, in native extension modules, and in the Python interpreter itself.

It can generate several different types of reports to help you analyze the captured memory usage data. While commonly used as a CLI tool, it can also be used as a library to perform more fine-grained profiling tasks.

Key Features:

  • ๐Ÿ•ต๏ธโ€โ™€๏ธ Traces every function call so it can accurately represent the call stack, unlike sampling profilers.
  • โ„ญ Also handles native calls in C/C++ libraries so the entire call stack is present in the results.
  • ๐ŸŽ Blazing fast! Profiling slows the application only slightly. Tracking native code is somewhat slower, but this can be enabled or disabled on demand.
  • ๐Ÿ“ˆ It can generate various reports about the collected memory usage data, like flame graphs.
  • ๐Ÿงต Works with Python threads.
  • ๐Ÿ‘ฝ๐Ÿงต Works with native-threads (e.g. C++ threads in C extensions).

How can Memray memory profiler help you:

  • Analyze allocations in applications to help discover the cause of high memory usage.
  • Find memory leaks.
  • Find hotspots in code that cause a lot of allocations.

Find Memray on GitHub -> Memray - Memory profiler for Python

Note: Memray only works on Linux and MacOS, and cannot be installed on other platforms.

More tools in Memory

fuite logo

fuite

Memory

A tool for finding memory leaks in web apps

Free
Pee.js logo

Pee.js

Memory

A javascript Library for leaking memory

Free
SNAKEVIZ logo

SNAKEVIZ

Memory

Python Memory Profilling

Free