Bill Allombert on Mon, 7 Apr 2003 12:24:02 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: GMP kernel and stack abuse


On Mon, Apr 07, 2003 at 02:08:29AM -0400, Igor Schein wrote:
> Hi,
> 
> % gp -q -f -s32m
> ? factormod(x^2+1,2^2^24+1);
> Segmentation fault
> 
> Default oprimized kernel doesn't exhibit this behavior.

I think it is in the FAQ:

  Using the GMP kernel, my session dies on a huge division!

   This is a general problem in GMP, which may allocate a huge amount of
   memory in the process stack space (using alloca). The best solution so far
   is to increase the maximum size of the process stack segment before
   starting gp from the shell. Alternatively, you might wish to configure GMP
   with

     configure --enable-alloca=malloc-noreentrant

   but this will slow down GMP.

This is a really nasty problem. 

Cheers,
Bill