Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 178339 - dev-lang/php-5.2.2-r1 with GMP compiled exhausts memory
Summary: dev-lang/php-5.2.2-r1 with GMP compiled exhausts memory
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal
Assignee: PHP Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-13 13:36 UTC by Sebastian Araya
Modified: 2007-08-10 17:08 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Araya 2007-05-13 13:36:59 UTC
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>".

The CLI program <file.php> works fine with PHP 5.1.6-r11; hardware hasn't been updated (so RAM is up to 2GB).


Reproducible: Always

Steps to Reproduce:
1. emerge php-5.2.2-r1
2. run an iterated procedure which works with gmp functions (such as gmp_init, gmp_div, gmp_and, etc.), like this:

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";
}

Actual Results:  
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)


Expected Results:  
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.
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2007-08-10 17:08:15 UTC
This is still reproducible using the latest CVS snapshot (php-5.2.4_pre200708051230-r2).

Please, report this upstream (http://bugs.php.net/) and post the URL here for tracking; we don't apply any gmp-related patches, not a Gentoo issue most likely.