From: Geert Fannes Date: 2005-08-23T22:54:04+09:00 Subject: Very strange GC behaviour ------_=_NextPart_001_01C5A7EA.1D7D496D Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hello, can someone explain why GC fails to release "a" in the program hereunder. When I exchange the lines "a=3DA.new" and "b=3DB.new", GC = fails to release b.=20 =20 PROGRAM #create some dummy classes class A;end class B;end =20 #create two variables, one for each dummy class a=3DA.new b=3DB.new =20 #store the object_id's for these object to check if these are still present bid=3Db.object_id aid=3Da.object_id =20 #check which objects can still be found ObjectSpace.each_object{|obj|puts("a still found") if obj.object_id=3D=3Daid;puts("b still found") if obj.object_id=3D=3Dbid} puts("") =20 #set both objects to nil and do garbage collection b=3Dnil a=3Dnil GC.start =20 #check again which object are still present. Both a and b should be gone, but that is not the case ObjectSpace.each_object{|obj|puts("a still found") if obj.object_id=3D=3Daid;puts("b still found") if obj.object_id=3D=3Dbid} =20 =20 OUTPUT: gfannes@ivon gruby $ ruby test.rb b still found a still found =20 a still found gfannes@ivon gruby $ =20 Greetings, Geert ------_=_NextPart_001_01C5A7EA.1D7D496D--