From: Christian Neukirchen Date: 2006-02-05T20:33:40+09:00 Subject: Re: Problem with weak references on OS X 10.3 Caleb Clausen writes: > 100_000.times{|n| > o=Object.new; > i=o.__id__; > o2=ObjectSpace._id2ref(i); > o.equal? o2 or raise "o=#{o}, i=#{"%x"%i}, o2=#{o2.inspect}, n=#{n}" > } > > The exception should never be raised. On my OS X 10.3.9 system (and at > least 1 other) it does get eventually raised after a few hundred > iterations using ruby 1.8 and 1.9. With the (apple-supplied) ruby 1.6, > it does not happen. Tests on several Windows and Linux systems have > never observed a problem, using ruby 1.8 and 1.9. I don't know if it's > a problem on OS X 10.4; I don't have access to any 10.4 systems. > > The problem seems to be in the call to __id__. Usually, it works > correctly, but every once in a while it returns the id of some random > symbol. Does anyone know why this is happening? I can reproduce on ruby 1.8.4 (2005-12-24) [powerpc-darwin7.9.0]: o=#, i=ea10e, o2=:reject, n=448 (RuntimeError) It looks like the object id wrapped in some way and now points to a symbol? Clearly looks like a bug. -- Christian Neukirchen http://chneukirchen.org