I think Koichi's approach is a better one. I don't think there are any 
needs to actually garbage collect internally used symbols like method 
names and the like.

You'll usually want to collect symbols created with to_sym. They should 
probably be stored in a separate location.

Em 07-02-2013 01:20, "Martin J. Drst" escreveu:
> A slightly different idea, closer to the existing garbage collection:
>
> The existing garbage collection is based on finding all pointers to 
> locations that can possibly be heap locations. This is done by 
> scanning the stack and all kinds of other locations that may keep heap 
> pointers.
>
> So to garbage collect symbols, one would scan all the locations that 
> possibly might contain symbols. As far as I remember from Minero 
> Aoki's black book, pointers, integers, and symbols (and 
> true/false/nil) partition the space of 32-bit (or 64-bit) integers.
>
> This scan would have to include all the Ruby-internal data structures 
> that use symbols. As with the current "pessimistic" garbage collector, 
> any 32-bit (or 64-bit) value that is found and is the same as an 
> existing symbol would make that symbol non-garbage-collectible. If no 
> such symbol is found, the symbol would be collected.
>
> Anyway, this is just an idea, there may be quite a few downsides to it.
>
> Regards,   Martin.