Memory leak by Array#sort!

e$B0J2<$N$h$&$K!"e(BArray#sort!
e$B$NCf$GG[Ns$rJQ99$9$k$H%a%b$j%j!<%/$7$^$9!#e(B

% ./ruby -ve ’
loop {
ary = (1…100).to_a
ary.sort! {|a,b| ary[0] = “a”; a <=> b}
GC.start
puts File.read("/proc/#{$$}/status").lines.grep(/^VmSize/)
}

ruby 1.9.0 (2008-05-16 revision 16436) [i686-linux]
VmSize: 7256 kB

VmSize: 27220 kB

e$B$"$H!">e5-$N%9%/%j%W%H$re(B ^C e$B$G;_$a$?;~!“0J2<$Ne(B TypeError
e$B$Ke(B
e$B$J$k$3$H$,$”$j$^$9!#e(B

-e:6:in write': invalid inspect_tbl list for :write in #<Thread:0x81bc620 run> (TypeError) from -e:6:inputs’
from -e:6:in puts' from -e:6:inblock in ’
from -e:2:in loop' from -e:2:in

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

In message “Re: [ruby-dev:34726] memory leak by Array#sort!”
on Fri, 16 May 2008 18:05:55 +0900, Tanaka A. [email protected]
writes:

|e$B0J2<$N$h$&$K!"e(BArray#sort! e$B$NCf$GG[Ns$rJQ99$9$k$H%a%b$j%j!<%/$7$^$9!#e(B

e$BD>$7$^$7$?!#$^$5$+!"@55,I=8=%^%C%A$K$b%j!<%/$,$"$k$H$O;W$$$^e(B
e$B$;$s$G$7$?!#%l%8%9%?!<$re(Bfreee$B$9$k$N$rK:$l$F$^$7$?!#e(B

|e$B$"$H!">e5-$N%9%/%j%W%H$re(B ^C e$B$G;_$a$?;~!“0J2<$Ne(B TypeError e$B$Ke(B
|e$B$J$k$3$H$,$”$j$^$9!#e(B
|
|-e:6:in write': invalid inspect_tbl list for :write in #<Thread:0x81bc620 run> (TypeError) | from -e:6:inputs’
| from -e:6:in puts' | from -e:6:inblock in ’
| from -e:2:in loop' | from -e:2:in

e$B$3$A$i$O:F8=$7$^$;$s$G$7$?!#e(B

In article [email protected],
Yukihiro M. [email protected] writes:

e$BD>$7$^$7$?!#$^$5$+!"@55,I=8=%^%C%A$K$b%j!<%/$,$"$k$H$O;W$$$^e(B
e$B$;$s$G$7$?!#%l%8%9%?!<$re(Bfreee$B$9$k$N$rK:$l$F$^$7$?!#e(B

[email protected]$,F~$C$F$+$ie(B test-all e$B$,e(B SEGV e$B$7$F$$$^$9!#e(B

http://www.rubyist.net/~akr/chkbuild/debian-sarge/ruby-trunk/log/20080517T064901.txt.gz

[email protected]$5$s$NJQ99$N8e$G$be(B SEGV e$B$N$^$^$G$9!#e(B

http://www.rubyist.net/~akr/chkbuild/debian-sarge/ruby-trunk/log/20080517T144700.txt.gz

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

At Sat, 17 May 2008 03:23:27 +0900,
Yukihiro M. wrote in [ruby-dev:34731]:

|e$B0J2<$N$h$&$K!"e(BArray#sort! e$B$NCf$GG[Ns$rJQ99$9$k$H%a%b$j%j!<%/$7$^$9!#e(B

e$BD>$7$^$7$?!#$^$5$+!"@55,I=8=%^%C%A$K$b%j!<%/$,$"$k$H$O;W$$$^e(B
e$B$;$s$G$7$?!#%l%8%9%?!<$re(Bfreee$B$9$k$N$rK:$l$F$^$7$?!#e(B

e$B0J2<$N$h$&$J%3!<%I$Ge(BSEGVe$B$7$^$9!#e(B

xary = (1…100).to_a
loop {
ary = (1…100).to_a
ary.sort! {|a,b| ary.replace(xary); a <=> b}
GC.start
puts File.read("/proc/#{$$}/status").lines.grep(/^VmSize/)
}

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