FW: Is GMP safe for using on multi core processors with openmp or pthreads?

Torbjorn Granlund tg at gmplib.org
Thu Jul 30 20:35:45 CEST 2009

David Carver <dcarver at tacc.utexas.edu> writes:

  Finally, using the information from the previous two articles I was
  able to link the example program with the Hoards malloc library and
  have Valgrind not report any memory leaks.
So Hoards is a reentrant malloc unlike the malloc your gmp application
was linked to by default.
  I suggest maybe adding another section in the GMP documentation to
  address multi threaded issues with GMP.
What makes you think this is an issue with GMP?

If the memory allocation functions set by a call to
mp_set_memory_functions (or malloc and friends by default) are not
reentrant, then GMP will not be reentrant either.

I would be *very* surprised if you could not trigger the problem with
just a simple malloc loop, not involving GMP.


More information about the gmp-discuss mailing list