1.7 KiB
| draft | date | categories | authors | ||
|---|---|---|---|---|---|
| false | 2024-02-20 |
|
|
Remote memory profiling with Memray
Memray is a memory profiler for Python, built by some very smart devs at Bloomberg. It is a fantastic tool to identify memory leaks in your code or other libraries (down to the C level)!
They recently added a Textual interface which looks amazing, and lets you monitor your process right from the terminal:
You would typically run this locally, or over a ssh session, but it is also possible to serve the interface over the web with the help of textual-web. I'm not sure if even the Memray devs themselves are aware of this, but here's how.
First install Textual web (ideally with pipx) alongside Memray:
pipx install textual-web
Now you can serve Memray with the following command (replace the text in quotes with your Memray options):
textual-web -r "memray run --live -m http.server"
This will return a URL you can use to access the Memray app from anywhere. Here's a quick video of that in action:
Found this interesting?
Join our Discord server if you want to discuss this post with the Textual devs or community.
