
Most Memory Leaks are Good - Shopify
10/14/2011
This post details a specific instance of a memory leak in a Shopify application, leading to `Errno::ENOMEM` errors and system instability. It explores the challenges of identifying and reproducing memory leaks, contrasting 'good' (intentional global allocations) and 'bad' (unintentional, growing allocations) leaks. The post discusses the use of tools like memprof for Ruby-level memory profiling and VM dumps, as well as the limitations when leaks occur in C extensions. It emphasizes the importance of reproducible environments, teamwork, and trusting hunches in debugging. The root cause was identified as a bug in the memcached client library, which was temporarily switched out and later fixed by the library author. The post concludes with advice on making leaks reproducible, trusting hunches, and collaborating with others.