[Bug #842] endless loop of ObjectSpace.each_object


#1

Bug #842: endless loop of ObjectSpace.each_object
http://redmine.ruby-lang.org/issues/show/842

e$B5/I<<Te(B: Narihiro N.
e$B%9%F!<%?%9e(B: Open, e$BM%@hEYe(B: Normal

narie$B$G$9!%e(B

e$B0J2<$NMM$K$9$k$HL58B%k!<%W$KF~$j$^$9!%e(B

$ ./miniruby -v
ruby 1.9.1 (2008-12-10 revision 20602) [i686-linux]
$ ./miniruby -e “GC.disable; ObjectSpace.each_object{ String.new(‘a’) }”

e$B$3$l$,%P%0$J$N$+$I$&$+J,$+$j$^$;$s$G$7$?!%e(B
GC.disablee$B$J>uBV$G$NF0:n$G$9$N$GEvA3$H$$$($PEvA3$J$N$G$9$,!%!%e(B
e$B=$@5$9$k%Q%C%A$rE:IU$$$?$7$^$9$N$G!$$48!F$Dx$h$m$7$/$*4j$$$7$^$9!%e(B

Index: gc.c

— gc.c (revision 20602)
+++ gc.c (working copy)
@@ -2089,7 +2089,9 @@
RVALUE *membase = 0;
RVALUE *p, *pend;
volatile VALUE v;

  • int old_dont_gc = dont_gc;

  • if (old_dont_gc) dont_gc = Qfalse;
    i = 0;
    while (i < heaps_used) {
    while (0 < i && (uintptr_t)membase <
    (uintptr_t)heaps[i-1].membase)
    @@ -2123,6 +2125,7 @@
    }
    }

  • dont_gc = old_dont_gc;
    return SIZET2NUM(n);
    }


#2

e$B%A%1%C%He(B #842 e$B$,99?7$5$l$^$7$?!#e(B (by Yuki S.)

e$B%9%F!<%?%9e(B Opene$B$+$ie(BRejectede$B$KJQ99e(B

@ Rubye$B3+H/2q5De(B

each_objecte$BCf$K@8@.$5$l$?%*%V%8%’%/%H$,e(Beach_objecte$B$K=P8=$9$k$+$I$&$+$OITDje(B

  • e$B=P8=$9$k>l9g!"@8@.$7B3$1$l$P=*N;$7$J$$%1!<%9$,$"$k$3$H$O;EMMe(B

http://redmine.ruby-lang.org/issues/show/842