원클릭으로
memray
// Profile the memory usage of a Python script using memray and visualize a temporal flamegraph in the browser. Use when the user wants to investigate memory consumption, find leaks, or understand allocation patterns.
// Profile the memory usage of a Python script using memray and visualize a temporal flamegraph in the browser. Use when the user wants to investigate memory consumption, find leaks, or understand allocation patterns.
Profile Python import time using profimp and open a waterfall HTML report. Use when investigating slow startup or wanting to identify which imports are most expensive.
Profile the execution time of a Python script using py-spy and visualize the result with speedscope. Use when the user wants to benchmark performance, find slow code paths, or profile CPU time.
| name | memray |
| description | Profile the memory usage of a Python script using memray and visualize a temporal flamegraph in the browser. Use when the user wants to investigate memory consumption, find leaks, or understand allocation patterns. |
| compatibility | Requires the pixi profiling environment (pixi run -e profiling). Supports Linux and macOS. |
| allowed-tools | Bash(pixi run -e profiling memray-run:*) Bash(pixi run -e profiling memray-flame:*) Bash(open:*) Bash(xdg-open:*) Bash(python -m webbrowser:*) |
Ask the user which script to profile (full or relative path).
Run the script under memray:
pixi run -e profiling memray-run script.py
This produces a binary file named memray-script.py.<pid>.bin in the current directory.
Generate the flamegraph HTML report from the .bin file:
pixi run -e profiling memray-flame memray-script.py.<pid>.bin
Replace <pid> with the actual PID shown in the filename. This writes memray-flamegraph-script.py.<pid>.html.
Open the report in the browser:
open memray-flamegraph-script.py.<pid>.htmlxdg-open memray-flamegraph-script.py.<pid>.htmlpython -m webbrowser memray-flamegraph-script.py.<pid>.html--temporal flag (included in memray-flame) shows memory over time, not just peak — use this to spot leaks and allocation bursts..bin file if unsure of the name: ls memray-*.bincp memray-flamegraph-script.py.<pid>.html memray-flamegraph-before.html