memory allocation in mpn routines

souvik bhattacherjee souvik99 at
Mon Jul 27 08:41:42 CEST 2009

Hi all,

I'm using the low-level mpn routines in a multi-threaded program.  As it is
well known that malloc () maintains a single heap, and thus only one thread
can allocate/deallocate memory at any given time, thus degrading performance
of the multi-thread code. However, as reported in literature this problem
can be overcome using Hoard, one of the several memory allocators available
so far. Is the memory allocated to the mpn routines in the form of operands
sufficient for their computations or do they allocate/deallocate additional
memory from heap apart from that. Secondly, if at all the routines
allocate/deallocate additional memory, does it ensure efficient memory
allocation for multi-threaded applications (like the ones in Hoard) ? If
not, is it possible to compile GMP with Hoard or something else so as to
overcome this problem.

What if someone uses mpz routines or routines other than mpn ?

Best Regards,
Souvik Bhattacherjee

More information about the gmp-discuss mailing list