On 27/06/2012, at 4:35 PM, nobu (Nobuyoshi Nakada) wrote:
> headius (Charles Nutter) wrote:
>> Finalizers in JRuby are stored on a reference from the object itself, =
so they don't actually prevent the object from collecting.
>=20
> You're missing the point.

Is he? Surely somewhere in that loop{finalized_puts []} the GC will =
activate,
and that will find collectable objects (with finalisers attached in =
JRuby). In
MRI, they might be found but they won't be finalised, if I understand =
the
behaviour right.

Clifford Heath.

> ----------------------------------------
> Bug #6614: GC doesn't collect objects bound to (collectable) proc
> https://bugs.ruby-lang.org/issues/6614#change-27513
>=20
> Author: rogerdpack (Roger Pack)
> Status: Rejected
> Priority: Normal
> Assignee:=20
> Category:=20
> Target version:=20
> ruby -v: tcs-ruby 1.9.3p28 (2012-01-28, TCS patched 2012-01-30) =
[i386-mingw32]
>=20
>=20
> Hello all.
> Previously discussed here: http://www.ruby-forum.com/topic/4402823
>=20
> I would expect the following code to eventually run the finalizers =
mentioned:
>=20
> def finalized_puts bad
>    ObjectSpace.define_finalizer(bad) { print 'collector run', bad }
> end
>=20
> loop { finalized_puts [] }
>=20
> This works in jruby as expected, but not in MRI.  This has the =
unfortunate side effect of making define_finalizer *very* difficult to =
actually use right =
http://www.mikeperham.com/2010/02/24/the-trouble-with-ruby-finalizers/
>=20
> Cheers!
>=20
>=20
>=20
> --=20
> http://bugs.ruby-lang.org/
>=20