From: matz@... (Yukihiro Matsumoto) Date: 2001-05-22T12:43:18+09:00 Subject: [ruby-talk:15520] Re: Newbie GC question Hi, In message "[ruby-talk:15512] Newbie GC question" on 01/05/22, Ashley Roeckelein writes: |I have a question regarding the Ruby GC and strings vs. symbols. I'm |working on my first "learn Ruby" Ruby program, and have come to the option |of representing "data" as either strings or as symbols. As I understand |it, when invoked, the GC will "clean out" any unreferenced strings that may |be laying around - I wonder if the GC also does this with any unreferenced |"interned" symbols too? i.e. will the GC also clean out any unreferenced |symbols? No. GC does not reclaim "unreferenced" symbols (because I couldn't define "unreferenced" status for symbols), so that symbol table never gets smaller. |My guess is yes, so given this assumption, is there any performance or |memory advantages to using symbols over strings, or vice-versa? Use symbols, if you concern about performance and memory consumption. They are immediate values thus being far effective. matz.