From: Roger Pack Date: 2008-05-09T00:43:19+09:00 Subject: Re: Comparing String with Symbol > I'd rather use to_sym instead of to_s. > > matz. I'd use either one except that [quoting Tim Harper] once a symbol is allocated, it is never garbage collected. This opens up a potential DOS attack: if you convert any user input to symbols (via #to_sym or #intern), they could easily fill your symbol space up and eat all of the available system memory. We'd all be wiser than I was a few minutes ago to keep this present when deciding whether to use symbols or strings: http://blog.hasmanythrough.com/2008/4/19/symbols-are-not-pretty-strings -- or, in other words loop { rand(10000000).to_sym } # uses up memory in a hurry :) -R -- Posted via http://www.ruby-forum.com/.