[MLton] Re: [Haskell-cafe] fastest Fibonacci numbers in the West
William Lee Irwin III
wli@holomorphy.com
Thu, 27 Jan 2005 11:14:01 -0800
At some point in the past, someone wrote:
>> I think a good thing to check would be a C version using libgmp.
>> That might help in determining if MLton has any of the blame...
On Thu, Jan 27, 2005 at 01:56:47PM -0500, Matthew Fluet wrote:
> I think this FAQ entry from the GnuMP website explains it.
> Q: I get a Segfault/Bus error in a program that uses GMP to calculate
> numbers with several hundred thousand digits. Why?
> A: GMP allocates most temporaries on the stack, and some machines give
> user programs very little stack space by default. See setrlimit(2) for
> information on how to increase the stack allocation. You can also change
> it from the shell (using ulimit or limit depending on the shell). You can
> also configure with --disable-alloca to instead allocate temporaries using
> malloc, but that will make the library run somewhat slower.
I just "fixed" the 10^8-1 case by raising the stack rlimits, so I think
we have a winner. Perhaps --disable-alloca should be considered by debian.
-- wli