So you suspect you have a memory leak...
Replit engineers encountered a memory leak in their Agent processes, causing hourly crashes and slowdowns. Standard profiling tools were incompatible with the asyncio-flavored Python codebase. They opted for memray, an out-of-process memory profiler, which identified hundreds of MiB of un-freed allocated objects within minutes. Despite identifying the leaked objects, the root cause remained elusive as they weren't intentionally stored in global variables. AI
IMPACT Details a debugging technique for memory leaks in Python, relevant for developers working with AI agents and complex Python applications.