I wanted to track a memory leak in a Python program. The program was leaking only in production and so I had to figure out how to use Memray to attach to a process in Kubernetes. There were a few hurdles on the way, so here’s what I did. Add Memray to your container image. We use Poetry for our Python projects, so I added Memray as a dependency. poetry add memray If you’re using the official Docker Python images as a base, be sure to use the non-slim variant. The debug symbols have been s...