1.8 NoMemoryError

1.8 e$B$G0J2<$N$h$&$Ke(B NoMemoryError e$B$,=P$k$h$&$JG[Ns3NJ]$r7+$je(B
e$BJV$79T$&$H!"e(B2e$B2s$a$G%W%m%;%9$,CfCG$7$^$9!#e(B

% limit addressspace 300m
% ./ruby -ve ’
4.times {|i|
p i
begin
Array.new(1 << 28)
rescue NoMemoryError
p $!
end
}’
ruby 1.8.7 (2008-05-15 patchlevel 5000) [i686-linux]
0
#<NoMemoryError: failed to allocate memory>
1
[FATAL] failed to allocate memory
zsh: exit 1 ./ruby -ve

1.9 e$B$G$O$=$&$$$&CfCG$O5/$3$j$^$;$s!#e(B

% ./ruby -ve ’
4.times {|i|
p i
begin
Array.new(1 << 28)
rescue NoMemoryError
p $!
end
}’
ruby 1.9.0 (2008-05-14 revision 16414) [i686-linux]
0
#<NoMemoryError: failed to allocate memory>
1
#<NoMemoryError: failed to allocate memory>
2
#<NoMemoryError: failed to allocate memory>
3
#<NoMemoryError: failed to allocate memory>

rubyspec e$B$re(B LP64 e$B$J%^%7%s$GF0$+$9$He(B (e$B$*$=$i$/e(B)
e$B$3$l$,860x$Ge(B
e$BESCf$GCfCG$7$A$c$&$s$G$9$,!"e(B1.8 e$B$N5sF0$O0U?^$5$l$?$b$N$G$7$ge(B
e$B$&$+!#e(B