Rob Burns on Mon, 14 Dec 2015 04:53:28 +0100

 Memory question

• To: pari-users@pari.math.u-bordeaux.fr
• Subject: Memory question
• From: Rob Burns <burrobert@gmail.com>
• Date: Mon, 14 Dec 2015 14:53:20 +1100
• Delivery-date: Mon, 14 Dec 2015 04:53:28 +0100
• Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=bsBAnPzVX7tdXffYlkM6H/VCy4Yh7wnM+Qz9clYpTfE=; b=KRXtMXWDgj+ZtCFV18a87cO+W1by8kI1oqUl1EdHK7j2VcMXYoxIKOuAhlxXS7+FLe NDes9Y3ygbQhw9Pn/8xj+iO7l1VFWa6XKm6SXN1rlnOUM0u5o9vP0MRABsbLZkBPpU2G Zs4BNByzGy5KSIM5tewD4LQXQwJ4scnaXN7VViKbwsKphC4CjiSXGZH5D8qsX42kt4Yz L5ab8zu4ip2vhDI9zxyPSSJ6+aPifwcz9NkLcvrOfTp8SvE4MfXMlZiAaCviR21es8FB ekFlvw8i1Tw73GZTiDA6pO+v5q1pHjFxHj1wdHDqSMm/hYGov2fhu2jaIPUaWCtE94LD 1QFQ==

Is anyone able to explain or interpret the following please? I wrote the following simple program to test pari memory limits. It calculates powers of 2:

pari_init(2000000000,2);

m = gen_1;

for (i=1; a<1000000; a++) {

m = gmul2n(m, 1);

}

pari_close();

The PARI stack overflows around a = 179000. However at this point m is only around 2800 bytes according to taille2. Adding in some garbage collection only improves the result by a small amount.

The same algorithm written with gmp can run up to a = 10^7 while using at most 1.93 GB of memory.

Rob.

--
“He who controls the past controls the future. He who controls the present controls the past.”

“War is peace.
Freedom is slavery.
Ignorance is strength.”

“If you want a picture of the future, imagine a boot stamping on a human face—for ever.”

“But if thought corrupts language, language can also corrupt thought.”

― George Orwell, 1984