On 1/17/02 6:35 AM, "Dave Thomas" <Dave / PragmaticProgrammer.com> wrote:

> 
> I was sent the following by Philippe de Rochambeau, but not having a
> Mac I can't confirm it:
> 
> 
>   I would like to report a bug report for Ruby 1.6.6 on darwin (MacOSX
>   10.1.2).
> 
>   The following program makes Ruby crash whenever you use the number
>   400.
> 
>   # Save this as fact.rb
>   def fact(n)
>   if n == 0
>   1
>   else
>   n * fact(n-1)
>   end
>   end
>   print fact(ARGV[0].to_i), "\n"
> 
> 
>   For instance, ruby fact.rb 40 works but ruby fact.rb 400 crashes Ruby.
> 

I'll try to work on this in my copious spare time. It seems like a good
project to learn Ruby.

I'm still not quite sure what Phillippe meant by 'crash' or if he means
something different from 'hang'.

I tried Phillippe's case from bare Darwin and at n=53 the program reports
"Illegal instruction" immediately.

I don't understand any of the stuff in this thread about 'stack overflow'. I
though that was something that only happened on Mac OS 9. On Darwin every
process gets 4 gigs. There must be some way to divide that between stack and
heap but I don't know it yet. I doubt that that's the problem.

I couldn't find ulimit in my one Linux book. I'm guessing that it has
something to do with setting how much stack and heap any user gets. Can't do
that here. Every user gets all they want until the memory manager runs out
of swap space.

The real problem is that none of us Mac wienies are man or woman enough to
run gdb from the command line. I'll try to build Ruby under Project Builder
and see what's happening.
-- 
We are all born originals - why is it so many of us die copies? -Edward
Young, poet (1683-1765)