Bloomberg has open-sourced Memray, a powerful memory profiler tool for python that it has been using.
Memray is a memory profiler tool for python that was developed by Bloomberg. Memray makes it easy to get stats of the memory allocated to applications. Memray can generate flame graphs reports of memory usage.
Memray works with
- native threads
- python thread
Importance of Memray
In Python, memory profiling is not as simple as we expect because of how the Python interpreter manages memory. This is where Memray comes in.
Memray can help you to
- Find out what it causing high memory usage
- Discover memory leaks
- Find code that is causing high memory allocation so that you can make the correct programming adjustments
Memray Installation requirements
- Memray can be installed from PyPI with a Python interpreter.
- You need to have Python 3.7+ to install it.
- Memray can only run on Linux OS.
Having stats of memory usage in your applications is important for microcomputers with little memory. If memory is not managed properly it can lead to apps crashing and loss of data.