Stack allocation

Torbjörn Granlund tg at gmplib.org
Fri Jun 6 16:44:34 UTC 2014


This started as a thread in gmp-discuss about crashes due to stack
overflow.

I modified the TMP_SALLOC macro in gmp-impl.h to print its allocation
argument.  I did this as I suspected that we sometimes invoke the SALLOC
form inappropriately for huge allocation.

Below is a sample output.  We clearly have some bad allocation code,
since TMP_SALLOC should only be used for small allocations.

ALLOC:721952
ALLOC:696992
PASS: t-mul
--
ALLOC:664480
ALLOC:664352
ALLOC:688288
ALLOC:688288
ALLOC:619296
ALLOC:619296
PASS: t-tdiv
--
ALLOC:642208
ALLOC:643744
ALLOC:642208
ALLOC:643744
ALLOC:642208
PASS: t-gcd
--
ALLOC:667424
ALLOC:667424
ALLOC:667424
ALLOC:661664
ALLOC:661664
ALLOC:661664
ALLOC:661664
ALLOC:661664
ALLOC:661664
ALLOC:667424
PASS: reuse
--
ALLOC:672544
ALLOC:652448
PASS: t-remove



Torbjörn
Please encrypt, key id 0xC8601622


More information about the gmp-devel mailing list