tracemalloc
git blame for memory: find which commit made your Python code use more RAM, and which function did it.
This is a debugging tool for tracing malloc that occurs inside a function or class.