From: Stanislav Sedov Date: 2009-06-19T20:48:37+09:00 Subject: [ruby-core:23928] Re: Broken finalizers in ruby 1.8 --Signature=_Fri__19_Jun_2009_15_48_23_+0400_gDOzN0JFBG02fWnJ Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, 18 Jun 2009 22:33:44 +0900 Nobuyoshi Nakada mentioned: > Hi, >=20 > At Thu, 18 Jun 2009 18:30:35 +0900, > Stanislav Sedov wrote in [ruby-core:23913]: > > The problem can be verified using the following simple snipplet: > >=20 > > % obj =3D "Test" > > % handler =3D Proc.new { puts "Finalized!" } > > % ObjectSpace.define_finalizer(obj, handler) >=20 > That handler contains the reference to obj, so it should not be > called. >=20 > > If you run this code in ruby 1.8.7 before r21435 it prints 'Finalized!'. >=20 > It's a bug. >=20 Sorry, I made a error in the snipplet above. It should read as following: % handler =3D Proc.new { puts "Finalized!" } % obj =3D "Test" % ObjectSpace.define_finalizer(obj, handler) I suspect that when running this code the finalizer should be called, as the 'handler' closure doesn't refer the obj object. However, it doesn't get called. Thanks! --=20 Stanislav Sedov ST4096-RIPE --Signature=_Fri__19_Jun_2009_15_48_23_+0400_gDOzN0JFBG02fWnJ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- iQIcBAEBAgAGBQJKO3sLAAoJEKN82nOYvCd0kh0P/0YzWl1i1K4yhtVJTzYkqxOB GSIEJbTJN8FGkNpVEMXUBSjgviuOotaaICwkOPLBDQKnn/NLFdKoFjNBn3IzCUv1 oybHgX4saLoDnijLL2O8zxqidBtPipAnTfFIMeGDKfArAKYqlKjEmUF5TtH9mbEY wLU3gEP81U0ZKp3HURDrP++a5SuuHF7ikUsIzQZVm4vS2LAuD2qdmmL3g5wiTyds Y6BtobS+wS2SJ7N0yy1SllUDjYzTNmnoN6fcX7K2h8xb2PWmN+YC65k1fERscQdU Luo/NfXSHyMiyKaxdtcd0QlDDGswZvpN3iP7mi1yyG82gZOBTNmRlIZZ0HaFfAza tTM7PC3gl5ccDlqNUjKR8nFHptkfjMuoOFkuTDGbWes8xUxZ4zyweNcCPjjZS+xE erZ+j4t96+ZZ3xsLwGu0DO+UOTlB54XMk1Kk+72KXNCghwrOyzUpob2mD8y6uUGx TQ9vOfUdkYSu3H0xQLNg/4XAMQj6bk9zx1dC3mOFGykl99pItKOjN2iNnXCIF6rd 5fQxOo2JtwrfayOLG1x/cOpt3UWb3CEfPUiJ/lBSvpoMoeN6CpQyNFz7XNwc1cMe Wvto3zAJq8Ga8vfaipWT4Od0EXH+0A28WIpSRsb5/hQAqICLenFrlmMKevpldE+R 8+hL8D+9XHfkqLMVlsHu =Q3Pv -----END PGP SIGNATURE----- --Signature=_Fri__19_Jun_2009_15_48_23_+0400_gDOzN0JFBG02fWnJ--