Interrupt in *

e$B0J2<$N$h$&$K$7$F!"e(B* e$B$N4V$Ke(B ^C [email protected]!"e(B
e$B$9$Y$F$N%*%V%8%’%/%H$re(B p e$B$7$F$_$k$H!"0[>o=*N;$7$^$9!#e(B

% ./ruby -e ‘n = 10**100000
begin
n * n
rescue Interrupt
p $!
end
ObjectSpace.each_object {|o|
begin
p o
rescue IOError
end
}

(n * n e$B$N7W;;$r$7$F$$$k4V$Ge(B ^C e$B$G3d$j9~$e(B) Interrupt "Interrupt" "Interrupt" "-e:3:in’"
"
"
"-e:3:in <main>'" ["-e:3:in*’", “-e:3:in `’”]
Interrupt
“”

-e:9: – control frame ----------
c:0009 p:---- s:0019 b:0019 l:000018 d:000018 CFUNC :to_s
c:0008 p:---- s:0017 b:0017 l:000016 d:000016 CFUNC :inspect
c:0007 p:---- s:0015 b:0015 l:000014 d:000014 CFUNC :stuck_out_tongue:
c:0006 p:0010 s:0011 b:0011 l:000005 d:000010 BLOCK -e:9
c:0005 p:---- s:0011 b:0011 l:000010 d:000010 FINISH :stuck_out_tongue:
c:0004 p:---- s:0009 b:0009 l:000008 d:000008 CFUNC :each_object
c:0003 p:0032 s:0006 b:0006 l:000005 d:000005 TOP -e:7
c:0002 p:---- s:0003 b:0003 l:000002 d:000002 FINISH :inherited
c:0001 p:---- s:0001 b:-001 l:000000 d:000000 ------

[email protected]$G$9!%e(B

Tanaka A. wrote:

e$B0J2<$N$h$&$K$7$F!"e(B* e$B$N4V$Ke(B ^C [email protected]!"e(B
e$B$9$Y$F$N%*%V%8%’%/%H$re(B p e$B$7$F$_$k$H!"0[>o=*N;$7$^$9!#e(B

e$B!!e(BSIGINT e$B$N=hM}$GIT40A4$Je(B bignum
e$B$,;D$C$A$c$C$?$+$i$+$J$"$H;W$C$?$se(B
e$B$G$9$,!$e(BSIGINT e$B$GCfCG$7$J$/$F$bH/@8$9$k$h$&$G$9!%C1$Ke(B to_s
e$B$KLdBj$,e(B
e$B$"$k!)e(B

e$B1sF#$H?=$7$^$9!#e(B

07/12/20 e$B$Ke(B SASADA Koichi[email protected] e$B$5$s$O=q$-$^$7$?e(B:

Tanaka A. wrote:

e$B0J2<$N$h$&$K$7$F!"e(B* e$B$N4V$Ke(B ^C [email protected]!"e(B
e$B$9$Y$F$N%*%V%8%’%/%H$re(B p e$B$7$F$_$k$H!"0[>o=*N;$7$^$9!#e(B

e$BLdBj$r4JC1$K$G$-$^$7$?!#0J2<$r<[email protected]$1$GMn$A$^$9!#e(B
e$B$^$?!"e(B[ruby-dev:32634] e$B$Ne(B Interrupt
e$B$N%Q%C%A$rEv$F$kA0$Ne(B
ruby e$B$G$bMn$A$^$9!#e(B

GC.stress = true
n = 10 ** 20000
ObjectSpace.each_object(Bignum) {|o| o.to_s }
ObjectSpace.each_object(Bignum) {|o| o.to_s }

e$B!!e(BSIGINT e$B$N=hM}$GIT40A4$Je(B bignum e$B$,;D$C$A$c$C$?$+$i$+$J$"$H;W$C$?$se(B
e$B$G$9$,!$e(BSIGINT e$B$GCfCG$7$J$/$F$bH/@8$9$k$h$&$G$9!%C1$Ke(B to_s e$B$KLdBj$,e(B
e$B$"$k!)e(B

e$B$d$O$j860x$Oe(B to_s e$B$N%P%[email protected]$H;W$$$^$9!#HO0O%A%’%C%/$,$^$:$/$Fe(B
BDIGITS e$B$N30B&$K%"%/%;%9$7$F!"%R!<%W$r$V$A2u$7$F$$$k$h$&$G$9!#e(B

Index: bignum.c

— bignum.c (revision 14348)
+++ bignum.c (working copy)
@@ -837,12 +837,12 @@
while (k–) {
ptr[–j] = ruby_digitmap[num % base];
num /= base;

  •        if (!trim && j <= 0) break;
    
  •        if (j <= 0) break;
           if (trim && i == 0 && num == 0) break;
       }
    
    }
    if (trim) {
  •    while (ptr[j] == '0') j++;
    
  •    while (j < len && ptr[j] == '0') j++;
       MEMMOVE(ptr, ptr + j, char, len - j);
       len -= j;
    
    }

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs