|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-01-06 12:18 UTC] scottmac@php.net
[2009-01-06 12:19 UTC] scottmac@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 06:00:01 2025 UTC |
Description: ------------ How to free gmp resources? i need a function like gmp_free() to free gmp resources. Reproduce code: --------------- <? function M($p){ return gmp_sub(gmp_pow(2,$p),1); } function S($i){ for($tmm=4,$j=0;$j<$i;$j++){ $tm1=gmp_pow($tmm,2);//gmp does not free memery,that is problem $tm2=gmp_sub($tm1,2); $tmm=$tm2; } return $tmm; } $p=31; echo $mp=gmp_strval(M($p)); if(0==gmp_strval(gmp_mod(S($p-2),$mp))){echo 'yes';}else{echo 'no';} ?> Expected result: ---------------- it should output a 'yes' or 'no'. need it tell me : is the number a prime number Actual result: -------------- [kee212@localhost ecc]$ php c.php 2147483647PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 335806464 bytes) in /var/www/html/kee212/ecc/c.php on line 8 Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 335806464 bytes) in /var/www/html/kee212/ecc/c.php on line 8