gcl-devel
[Top][All Lists]
Advanced

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

[Gcl-devel] Re: TMP_ALLOC in mpn_mul_n


From: Kevin Ryde
Subject: [Gcl-devel] Re: TMP_ALLOC in mpn_mul_n
Date: Thu, 01 Aug 2002 11:00:48 +1000
User-agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.1 (i386-debian-linux-gnu)

Camm Maguire <address@hidden> writes:
>
> Now I understand that gmp probably wants to use the heap by default
> for those really large 'bignums',

For temporary workspace normally alloca is used, but when an operation
is going to be slow anyway then malloc is used to avoid overflowing
the stack unnecessarily, as for example the toom-cook in mpn_mul_n.

> but would it be possible to provide
> a runtime option to use alloca and the C stack here? Either via a
> separate function, or a routine setting an internal variable, similar
> to the way in which one can set the (non-stack) allocation functions
> in mp_set_memory_functions?

Maybe.  But perhaps it'd be possible to give mp_set_memory_functions
routines with normal C semantics.  I understood the underlying problem
with gmp in gcl was that gmp couldn't cope with memory blocks being
moved around by a garbage collect that happened within a malloc or
realloc.


Incidentally, don't forget there's a gmp configuration option in the
other direction.  --disable-alloca means don't use alloca at all, but
malloc instead (or rather the mp_set_memory_functions routines).  Not
sure if anyone uses that unless that have to (ie. systems with limited
stack space).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]