From: matz@... (Yukihiro Matsumoto) Date: 2000-04-01T02:45:16+09:00 Subject: [ruby-talk:02305] Re: [Q]: _id2ref broken? Hi, In message "[ruby-talk:02262] [Q]: _id2ref broken?" on 00/03/30, Clemens Hintze writes: |Up to Ruby-1.2 it should have worked, here the code of _id2ref has |contained a piece of: | | : | if (RANY(ptr)->as.free.flag == 0) { | IndexError("0x%x is recycled object", ptr); | } | : | |But since Ruby-1.3.x the code was changed to: | | : | if (BUILTIN_TYPE(ptr) == 0) { | rb_raise(rb_eIndexError, "0x%x is recycled object", ptr); | } | : These codes are basicly doing same thing. The real difference is not there. but in gc_sweep(). It is for safety. Listen, Clemens, exporting a reference from _id2name in finalizer is really really dangerous in current implementation. So I prohibited. Your trial (calling `finalize' method of unreferenced object) is taking exactly this risk. Java-like two phase GC may solve this problem but I'm sure it would be performance penalty. matz.