Jim Weirich wrote: >> also, don't forget that symbols are __never__ freed. > > True, but when used properly, this is rarely a concern. If they are > used as programmer names for things, then the number of symbols is > finite and not likely to grow and consume memory as the program runs. Here I am replying to my own posting, but I think this point could use some elaboration. Why are symbols not garbage collected? Because a symbol represents a mapping from a string name to a unique object. Anytime in the execution of the program, if that name is used for a symbol, the original symbol object must be returned. If the symbol is garbage collected, then a later reference to the symbol name will return a different object. That's generally frowned upon (although I don't really see the harm. If the original symbol was GC'ed, nobody cared what the original object was anyways. But that's the way it works). This might be one area where the "Symbol isa immutable string" meme might be doing some real harm. We if think of symbols as strings, then we tend to build symbols dynamically like we do strings. This is when the memory leak" problem of symbols becomes a problem. Here's a rule of thumb ... if a programmer never sees the symbol name in the code base, then you probably should be using a string rather than a symbol. I'm not sure if this helped, or just muddied the water more. -- -- Jim Weirich -- Posted via http://www.ruby-forum.com/.