Reduced number of allocated limbs after calling mpz_remove

Torbjörn Granlund tg at gmplib.org
Tue May 21 07:30:47 CEST 2024


Niels Möller <nisse at lysator.liu.se> writes:

  I don't have a strong opinion on how to fix this discrepancy between
  docs and implementation. But I feel rather strongly that mini-gmp
  shpuldn't make this promise, so code that rely on it will not work with
  mini-gmp.

It is, in my opinion, not a bug in the code, nor is is a bug in the
documentation.

What we indended to say in the docs is that a variable which once
contained something large then will occupy lots of RAM even if is later
is used for only small things.  (This in turn was an optimisation as
trimming the allocation after each operaton would slow down GMP very,
very much.)

That's the only thing we should promise, as it has obvious exceptions.

It is possible that the docs need clarification.  Perhaps a "in most
cases" can be inserted somewhere?

-- 
Torbjörn
Please encrypt, key id 0xC8601622


More information about the gmp-bugs mailing list