mpz_t caching

Torbjörn Granlund tg at
Fri Sep 4 10:28:21 UTC 2015

Vincent Lefevre <vincent at> writes:

  In 2014, Patrick Pelissier (in Cc) implemented a mpz_t allocation
  cache for MPFR, redefining mpz_init and mpz_clear, in order to
  avoid some deallocations/allocations (via the indirect call to
  the allocation functions) when mpz_t's cleared and init'ed again
  a bit after. I've attached the patch that was applied to MPFR.
  I don't think that such a feature could benefit only MPFR, so that
  it may be a better idea to integrate something like that directly
  in GMP. What do you think?
I don't think libraries should hoard memory to compensate poor malloc
implementations.  If that became common practice, applications would use
more RAM without recourse.

Please encrypt, key id 0xC8601622

More information about the gmp-devel mailing list