Memory allocation of mpz_init
haberg-1 at telia.com
Thu Nov 17 12:33:52 CET 2011
On 17 Nov 2011, at 11:21, Torbjorn Granlund wrote:
> Why is mpz_init() allocating memory? Is it an optimization, or does
> programming of other functions becoming more convenient?
> It allocates memory in order to make space for limbs.
It incurs an overhead on the C++ move constructors, relative setting _mp_alloc = 0; the latter will make rend the object useless, a problem when it is not a temporary. A few times slower, when I check it more carefully, but maybe not significant relative other operations.
More information about the gmp-discuss