#42390 [Opn->Fbk]: GMP functions exhausts memory
| From: | jani@php.net | Date: | Tue, 28 Oct 2008 21:46:29 +0000 |
| Subject: | #42390 [Opn->Fbk]: GMP functions exhausts memory | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-130242@lists.php.net to get a copy of this message | ||
ID: 42390
Updated by: jani@php.net
Reported By: cbimax at gmail dot com
-Status: Open
+Status: Feedback
Bug Type: GNU MP related
Operating System: Linux Gentoo K.2.6.20
PHP Version: 5.2.5
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
Previous Comments:
------------------------------------------------------------------------
[2007-12-15 21:37:34] cbimax at gmail dot com
Now I install Gentoo from scratch, running on HP Proliant dual Xeon 3.6
(EM64T) 2GB RAM, with Linux Gentoo 2.6.22-r8 (64 bits)... so the example
works, but if I increase to 1,000,000 iterations it flaws again with:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to
allocate 16 bytes) in /home/admin/gmp-test.php on line 6
No other services, nor heavy processes running...
------------------------------------------------------------------------
[2007-12-02 14:16:53] cbimax at gmail dot com
Well, I tested against PHP 5.2.5 and it fails:
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to
allocate 12 bytes) in ./gmp-test.php on line 10
when trying to execute the example code.
------------------------------------------------------------------------
[2007-08-23 09:42:42] jani@php.net
I can not reproduce this using latest PHP 5.2.4-dev.
So please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
------------------------------------------------------------------------
[2007-08-22 21:39:29] cbimax at gmail dot com
Description:
------------
Any gmp_* function running on PHP 5.2.2-r1 (compiled with GMP
extensions), throws after a few invokes "Fatal error: Allowed memory
size of <varies from 7M to 8M> bytes exhausted (tried to allocate 16
bytes) in <file.php>".
Reproduce code:
---------------
for( $i= 0; $i!= 100000; $i++ )
{
$node = gmp_init( $i );
$id = gmp_div( $node, '0x100000000' );
$edge = gmp_and( $node, '0xffffffff' );
$vert = gmp_div( $node, '0x1000' );
$path = gmp_and( $node, '0x00ff' );
$str_edge = gmp_strval( $edge );
$str_vert = gmp_strval( $vert );
$str_path = gmp_strval( $path );
echo "Graph -> ($str_edge, $str_vert, $str_path) \n";
}
Expected result:
----------------
The iterated procedure runs on PHP 5.1.x (and PHP 5.0.x) near to 1
million times per call.
In this case, it's only runs 500 times and then drop the Fatal error.
Actual result:
--------------
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to
allocate 16 bytes) in quixtor/compute-graph-map.php on line 443
(actually line 443 isn't a gmp related function, but it is called under
for() iteration which uses GMP functions).
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42390&edit=1