GMP and static memory allocation

William Galway galwaymath at
Fri Dec 21 19:51:29 UTC 2018

You should begin by referring to these two sections of the GMP manual:
  3.6 Memory management
  13  Custom allocation
I haven't used it myself, but my guess is that "Custom allocation" should
solve your problem, and will not require recompiling GMP.  You will, of
course, need to give careful consideration to the functions that you use to
replace malloc(), etc.

-- Regards, William (Will) Galway

On Fri, Dec 21, 2018 at 12:42 PM Benedetto <bennygirge at> wrote:

> Hi everyone,
> I am developing some benchmarks for a constrained device (Zolertia
> Re-Mote) which use the GMP library. And due to the fact GMP uses
> malloc()'s to allocate memory i came across this problem:
> .
> Basically the size of the heap on this device is not sufficient to use
> GMP and, as you can read in the stackoverflow post, the OS i am using
> (contiki) discourages the use of dynamic memory. My question is: Is
> there an easy way i can compile GMP to use static memory instead?
> I have read the info section about "Temporary Memory" but from there it
> seems there is no way to do it.
> Thank you in advance,
> Benedetto Girgenti
> _______________________________________________
> gmp-discuss mailing list
> gmp-discuss at

More information about the gmp-discuss mailing list