C
Caleb Clausen
I am having problems with weak references. The program below exhibits
the problem:
100_000.times{|n|
o=3DObject.new;
i=3Do.__id__;
o2=3DObjectSpace._id2ref(i);
o.equal? o2 or raise "o=3D#{o}, i=3D#{"%x"%i}, o2=3D#{o2.inspect}, n=3D#{=
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?
the problem:
100_000.times{|n|
o=3DObject.new;
i=3Do.__id__;
o2=3DObjectSpace._id2ref(i);
o.equal? o2 or raise "o=3D#{o}, i=3D#{"%x"%i}, o2=3D#{o2.inspect}, n=3D#{=
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?