So while in the #RubyOnRails IRC channel late at night (never a good idea) some silly conversation occured: (someone gists some code) sevenseacat: empty array seems the silly thing to have Tarential: sometimes I like to add empty arrays, you know, just in case I need them later Tarential: so they’re close at hand tagrudev: little kittens die when you define an unused var brianpWins: but if you do want to leave empty arrays around.
This is just a quick bit that I learned early in my Ruby career and always found interesting. Symbols Are Memory Leaks So is this the end of the world? No Symbols are a unique thing in ruby. It’s immutable, constant and unique. You can re-use the same Symbol over and over without allocating extra memory. As opposed to using a String over and over which will allocate memory with each instance.