Thanks to Charlie Mills, who actually bothered to read the comment
in gc.c,
#if defined(__ia64__) && (!defined(__GNUC__) || __GNUC__ < 2 || defined(__OPTIMIZE__))
/* ruby crashes on IA64 if compiled with optimizer on */
/* when if STACK_LEVEL_MAX is greater than this magic number */
/* I know this is a kludge. I suspect optimizer bug */
we got yesterday's ruby-stable-snapshot built on NASA's SGI Altix cluster,
http://www1.nasa.gov/home/hqnews/2004/jul/HQ_04243_supercomput.html
by compiling with -O0.
We briefly tried turning off the optimization only for gc.c, but
gave up quickly.
Anyway, instead of only 44 levels with the crippled stack, we
managed to get to 105k stack levels before it seg-faulted and
dumped a >2GB core(!) with our little test code,
def helloLevel level
puts "hello world! "+level.to_s
helloLevel(level+1)
end
helloLevel 0
Much rejoicing,
···
--
Bil from the Ruby '04 Conference
Bil,
Congratulations!
Bil Kleb wrote:
Thanks to Charlie Mills, who actually bothered to read the comment
Kudos, Charlie.
in gc.c,
<snip>
>
Anyway, instead of only 44 levels with the crippled stack, we
managed to get to 105k stack levels before it seg-faulted and
dumped a >2GB core(!) with our little test code,
Just curious ... how many stack levels before it seg-faulted on the 32-bit version?
-- shanko
Shashank Date asked:
Bil Kleb wrote:
Anyway, instead of only 44 levels with the crippled stack, we
managed to get to 105k stack levels before it seg-faulted and
dumped a >2GB core(!) with our little test code,
Just curious ... how many stack levels before it seg-faulted on the 32-bit version?
$ cat > hello.rb
def helloLevel level
puts "hello world! "+level.to_s
helloLevel(level+1)
end
helloLevel 0
[Ctrl-d]
$ ruby hello.rb
[..]
hello world! 4542
hello.rb:3:in `helloLevel': stack level too deep (SystemStackError)
from hello.rb:3:in `helloLevel'
on linux x86. Note: it does not segfault, but raises an exception.
Adam Williams reports 1257 on OSX.3.
Regards,
···
--
Bil from Ruby Conf '04