ID:               47016
 Updated by:       [email protected]
 Reported By:      smallhorst at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         GNU MP related
 Operating System: fedora 9
 PHP Version:      5.3.0alpha3
 New Comment:

Not a PHP bug -> Bogus


Previous Comments:
------------------------------------------------------------------------

[2009-01-06 12:18:02] [email protected]

Before it does on my system its trying to do a 19,191,376 digit number
to the power of 2. This is using all of the memory, since GMP uses the
PHP memory allocation functions we correctly report back what line it
is.

Just to test I wrote a quick gmp_destroy() function and it got just as
far.

------------------------------------------------------------------------

[2009-01-06 09:49:22] smallhorst at gmail dot com

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 this bug report at http://bugs.php.net/?id=47016&edit=1

Reply via email to