BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News A Rails memory leak profiling solution

A Rails memory leak profiling solution

Scott Laird was dealing with the difficulties of finding memory leaks in his Rails apps and came up with solution:
Several people have been working on memory leak debuggers for Rails, and for Typo in general, including Steve Longdo, but I didn’t have a lot of luck actually finding leaks with their tools. I asked the Seattle Ruby Group for help, and Ryan Davis gave me a quick little memory leak spotter that he uses. I made a few additions to it, and it helped me discover that my Typo development tree was leaking 1-3 strings per hit, but it didn’t help me figure out where the leak was happening. After playing with a few options, I settled on dumping all strings to a file once per memory profiler loop, and then I diffed the files that showed my problem. It took about 15 seconds to discover a bug in my route cache code, and about 30 seconds more to fix it.
Scott put the code for his solution up on his blog, respondents have already called it an essential tools they'll use on their projects going forward, and Scott promised to package it up as a plugin eventually.

Rate this Article

Adoption
Style

BT