From: Ron M Date: 2005-12-29T19:43:56+09:00 Subject: Re: What is the difference between :foo and "foo" ? ara.t.howard@noaa.gov wrote: > > also, don't forget that symbols are __never__ freed. > this is a severe memory leak: > > loop{ Time::now.to_f.to_s.intern } I still wonder if the lack of garbage collection of symbols is merely a weakness in the current implementation, or something that's part of the Ruby language. Note that most lisps and javas can garbage collect symbols and interned strings. If it's just an implementation misfeature I'd love to see that limitation go away in YARV. Notes: *1 http://community.schemewiki.org/?scheme-faq-language "Most Schemes do perform garbage-collection of symbols, since otherwise programs using string->symbol to dynamically create symbols would consume ever increasing amounts of memory even if the created symbols are no longer being used." *2 http://mindprod.com/jgloss/interned.html "In the early JDKs, any string you interned could never be garbage collected because the JVM had to keep a reference to in its Hashtable so it could check each incoming string to see if it already had it in the pool. With JDK 1.2 came weak references. Now unused interned strings will be garbage collected."