Ilya Zakharevich on Mon, 7 Apr 2003 16:54:51 -0700


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

Re: GMP kernel and stack abuse


On Mon, Apr 07, 2003 at 11:50:51PM +0200, Bill Allombert wrote:
> > >   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.
> > 
> > We *know* the stack limit.  Why not use this knowledge to substitute
> > our alloca()?
> 
> Does not it require recompiling libgmp ?

So do it.  ;-)

> The stack overflow here is of the order of tens of megabytes.

So it is not hard to detect.  ;-)

Ilya