From: smallhorst at gmail dot com
Operating system: fedora 9
PHP version: 5.3.0alpha3
PHP Bug Type: GNU MP related
Bug description: how to free a gmp resources?
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:
--------------
[kee...@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
--
Edit bug report at http://bugs.php.net/?id=47016&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=47016&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=47016&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=47016&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=47016&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=47016&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=47016&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=47016&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=47016&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=47016&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=47016&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=47016&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=47016&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=47016&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=47016&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47016&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=47016&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=47016&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=47016&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=47016&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=47016&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=47016&r=mysqlcfg