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


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Memory question


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