From: cbimax at gmail dot com Operating system: Linux Gentoo K.2.6.20 PHP version: 5.2.3 PHP Bug Type: Math related Bug description: GMP functions exhausts memory
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 bug report at http://bugs.php.net/?id=42390&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42390&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42390&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42390&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42390&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42390&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42390&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42390&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42390&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42390&r=support Expected behavior: http://bugs.php.net/fix.php?id=42390&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42390&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42390&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42390&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42390&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42390&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42390&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42390&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42390&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42390&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42390&r=mysqlcfg