GC problem by rb_ary_new4(x, 0)

boron e$B$G$b5/$-$F$$$^$9$,!"<j85$G$be(B SEGV
e$B$9$k$N$GD4$Y$F$_$^$7$?!#e(B
http://www.rubyist.net/~akr/chkbuild/debian-sarge/ruby-trunk/log/20060624T002949.txt.gz

e$B$I$&$b!“e(Brb_ary_new4(i, 0) e$B$G3NJ]$7$?$N$r=i4|2=$9$kA0$Ke(B
rb_eval e$B$r8F$S=P$7$F$=$NCf$Ne(B GC e$B$G=i4|2=$7$F$J$$NN0h$r;2>H$7e(B
e$B$FLdBj$,5/$-$F$$$k!”$H$$$&$N$,$R$H$D$"$k$h$&$G$9!#e(B
([email protected]$1$G$O$J$$$h$&$G$9$,e(B)

  • e$B$=$b$=$b=i4|2=$7$J$$$s$J$ie(B rb_ary_new4 e$B$G$J$/$Fe(B
    rb_ary_new2 e$B$G$$$$$O$:e(B
  • e$B$=$l$O$=$l$H$7$Fe(B rb_ary_new4 e$B$,=i4|[email protected]$-$Fe(B
    e$B$$$kNN0h$H$9$k$N$O4m81e(B

e$B$J$N$G!"$3$s$J$+$s$8$G$7$g$&$+!#e(B

Index: array.c

RCS file: /src/ruby/array.c,v
retrieving revision 1.187
diff -u -r1.187 array.c
— array.c 9 Jun 2006 21:20:15 -0000 1.187
+++ array.c 24 Jun 2006 12:35:37 -0000
@@ -163,8 +163,8 @@
ary = rb_ary_new2(n);
if (n > 0 && elts) {
MEMCPY(RARRAY(ary)->ptr, elts, VALUE, n);

  •    RARRAY(ary)->len = n;
    
    }
  • RARRAY(ary)->len = n;

    return ary;
    }
    Index: eval.c
    ===================================================================
    RCS file: /src/ruby/eval.c,v
    retrieving revision 1.903
    diff -u -r1.903 eval.c
    — eval.c 23 Jun 2006 08:28:04 -0000 1.903
    +++ eval.c 24 Jun 2006 12:35:37 -0000
    @@ -3635,7 +3635,7 @@
    long i;

    i = node->nd_alen;

  •   val = rb_ary_new4(i, 0);
    
  •   val = rb_ary_new2(i);
      for (i=0;node;node=node->nd_next) {
      RARRAY(val)->ptr[i++] = rb_eval(self, node->nd_head);
      RARRAY(val)->len = i;
    

@@ -4881,7 +4881,7 @@
if (n == 0) {
return rb_yield_0(Qundef, 0, 0, 0);
}

  • val = rb_ary_new4(n, 0);
  • val = rb_ary_new2(n);
    va_start(args, n);
    for (i=0; i<n; i++) {
    RARRAY(val)->ptr[i] = va_arg(args, VALUE);

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:28826] GC problem by rb_ary_new4(x, 0)”
on Sat, 24 Jun 2006 21:50:18 +0900, Tanaka A. [email protected]
writes:

|boron e$B$G$b5/$-$F$$$^$9$,!"<j85$G$be(B SEGV e$B$9$k$N$GD4$Y$F$_$^$7$?!#e(B
|http://www.rubyist.net/~akr/chkbuild/debian-sarge/ruby-trunk/log/20060624T002949.txt.gz
|
|e$B$I$&$b!“e(Brb_ary_new4(i, 0) e$B$G3NJ]$7$?$N$r=i4|2=$9$kA0$Ke(B
|rb_eval e$B$r8F$S=P$7$F$=$NCf$Ne(B GC e$B$G=i4|2=$7$F$J$$NN0h$r;2>H$7e(B
|e$B$FLdBj$,5/$-$F$$$k!”$H$$$&$N$,$R$H$D$"$k$h$&$G$9!#e(B
|([email protected]$1$G$O$J$$$h$&$G$9$,e(B)
|
|* e$B$=$b$=$b=i4|2=$7$J$$$s$J$ie(B rb_ary_new4 e$B$G$J$/$Fe(B
| rb_ary_new2 e$B$G$$$$$O$:e(B
|* e$B$=$l$O$=$l$H$7$Fe(B rb_ary_new4 e$B$,=i4|[email protected]$-$Fe(B
| e$B$$$kNN0h$H$9$k$N$O4m81e(B
|
|e$B$J$N$G!"$3$s$J$+$s$8$G$7$g$&$+!#e(B

e$B$"$j$,$H$&$4$6$$$^$9!#%3%_%C%H$7$F$/[email protected]$5$$!#e(B

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