Memory usage for large multiplications
bodrato at mail.dm.unipi.it
bodrato at mail.dm.unipi.it
Fri Jan 29 15:07:45 CET 2010
Ciao,
>> GMP-5.0 uses an itch/scratch logic, it allocates (almost) all needed
>> memory before starting the computation, and frees it all at the end.
>> GMP-4.3 allocates, then frees, then allocates again, and frees again...
>> It is much more difficult to get the "maximal" snapshot.
>
> maybe this latter strategy is better, since at any time you have allocated
> just what is really needed (assume for example you have several GMP
> threads on the same computer).
For very large operands, the overhead of some alloc/free is probably not
relevant, and the locked memory can be huge.
But a single alloc and a single free is probably good a good strategy for
small operands...
I think we should discuss this idea for the next version.
... and maybe set a PREALLOCATE_THRESHOLD :-P (just kidding here)
Best regards,
Marco
--
http://bodrato.it/
More information about the gmp-devel
mailing list