Memray

From scverse/spatialdata · View interactive version

Memray is an AI agent skill from the GitHub repository scverse/spatialdata. 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.

How to use this skill

Skill file

Steps

  1. Ask the user which script to profile (full or relative path).
  1. Run the script under memray:

```bash

pixi run -e profiling memray-run script.py

```

This produces a binary file named memray-script.py.<pid>.bin in the current directory.

  1. Generate the flamegraph HTML report from the .bin file:

```bash

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.

  1. Open the report in the browser:

Notes

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.