From: Kent Sibilev Date: 2009-03-31T00:06:00+09:00 Subject: Re: Symbols garbage collector in Ruby1.9, fixed? On Mon, Mar 30, 2009 at 8:48 AM, James Gray wrote: > On Mar 30, 2009, at 7:16 AM, Brian Candler wrote: > >> Iņaki Baz Castillo wrote: >>> >>> I could use strings as keys instead of symbols, but I've checked that >>> getting a Hash entry is ~25% faster using Symbols. >>> >>> The problem is that I could receive custom headers so for each one a >>> new Symbol would be created. An attacker could send lots of custom >>> headers to fill the server memory and cause a denial of service. >>> >>> Perhaps this is solved in Ruby 1.9? any suggestion on it? Thanks a lot. >> >> It's not "solved" in 1.9, because this is intentional and necessary >> behaviour. > > Dave Thomas seems to have thought this was going away: > > http://pragdave.blogs.pragprog.com/pragdave/2008/05/ruby-symbols-in.html > > James Edward Gray II > Unfortunately, symbols are still not garbage-collected at the moment. It seems that the only difference comparing to 1.8 is that symbols are backed by real frozen string objects instead of arrays of chars. -- Kent