I’ve never met a developer who complained about code getting faster or taking up less RAM. In Ruby, memory is especially important, yet few developers know the ins-and-outs of why their memory use goes up or down as their code executes. This article will start you off with a basic understanding of how Ruby objects relate to memory use, and we’ll cover a few common tricks to speed up your code while using less memory.

Keep Reading on Sitepoint.com

If you’re still hungry for more information on memory and performance you can also check out my latest talk at RailsConf 2015.

Memory talk at RailsConf 2015

Speed science Video

I start talking about memory at the 13 minute mark. Before that I gave a story of debugging an app with slow disk IO.

Speed science Slides

Note: I was wrong about my statements in the video that “Ruby never releases memory”. For more information you can read about how it does free memory very slowly in How Ruby uses memory.