By the way.

I was a little concerned that having just a reference to a singleton
class without a reference to its single instance might not protect
that instance from being GCed.

I took a quick look through the ruby1.8 source and it looks like
singleton class objects have a hidden instance variable named
__attached__ which refers to the instance. This is what it uses to
compute it's string representation for example.

I don't think that theres any way to get at that through Ruby however,
for example instance_variable_get(:"__attached__") complains that
__attached__ is not a legal instance variable name.

So I guess you could write a C extension which accessed that hidden
variable, but in pure Ruby scanning using ObjectSpace.each_object
works albeit potentially less efficiently.

-- 
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/

IPMS/USA Region 12 Coordinator
http://ipmsr12.denhaven2.com/

Visit the Project Mercury Wiki Site
http://www.mercuryspacecraft.com/