Plugging leaky memory

Just because a language has garbage collection doesn't mean you still can't leak memory—you can easily leak memory, since quite a few modern langauges that have garbage collection have ways of calling into libraries written in C, and those can leak.

With that said, reading “Tracking down a memory leak in Ruby's EventMachine [1] (link via Hacker News [2]) was quite informative. Looking for patterns in the leaked memory as a means of tracking down what was being leaked was brilliant (“Well, as mentioned, 95+% of our program’s memory footprint is leaked objects. So if we just take a random sample of bits of memory, we will find leaked objects with very good probability.”). And I did not know you could call C functions from within gdb.

This is something I'll have to keep in mind for work.

[1] http://blog.nelhage.com/2013/03/tracking-an-eventmachine-leak/

[2] http://news.ycombinator.com/item?id=5338761

Gemini Mention this post

Contact the author