Hejsan Niels,

So not sure if code or docs should be adjusted ("usually not" rather
than "never"). Do you think the "never reduce their allocated space"
property is important for your usecase, or for other GMP applications
general? If the strong statement is kept, this should perhaps be mention
as another execption in mini-gmp/README.

In the project I help maintaining, we have started to rely on that mpz never reduce the number of limbs. This is to keep a minimum number of limbs allocated to 2, so that if one where to do a multiplication of two limbs, the result is guaranteed to fit inside the mpz without having to do a reallocation. Of course, the memory manager could check that recycled mpzs do have at least 2 limbs allocated, but that seems unnecessary since `mpz_remove` seems to be the exception.

Since this indeed seems to be the exception, I am fine with either documenting that this indeed is the exception (perhaps it should then be stated under the section "Memory management" as well as the docstring for `mpz_remove`), or fixing this in `mpz_remove`.

Best,
Albin
_______________________________________________
gmp-bugs mailing list
[email protected]
https://gmplib.org/mailman/listinfo/gmp-bugs

Reply via email to