Re:Ruby 2.2.0 Released
by current_call on Thursday December 25, 2014 @06:40AM
(#8796062)
It's a bit weird that symbols are garbage collected. I wouldn't think it could delete them without making the same symbols unequal some of the time.
[ Parent
| on HN ]
They are only garbage collected if they were introduced at runtime and there is no reference to them anymore. (detailed explanations can be found in the presentation linked in the announcement)
This allows you to symbolize external hash keys without fear of a DOS attack.
They're only going to get GCed if there aren't any references to them (like everything else) - so the comparison you're talking about is impossible. If you can still compare the symbol to something, it hasn't been GCed...