From: thomas dot hebinck at digionline dot de
Operating system: Linux
PHP version: 5.2.4
PHP Bug Type: *Math Functions
Bug description: GMP without gmp_init eats memory
Description:
------------
Various GMP Functions eat memory, when not called directly with integers
or strings instead of gmp resources.
Reproduce code:
---------------
$a='1234';
for($i=0;$i<200000;$i++) {
$c=gmp_add(gmp_init($a),gmp_init($a));
}
echo memory_get_usage() . "¶\n";
for($i=0;$i<200000;$i++) {
$c=gmp_add($a,$a);
}
echo memory_get_usage() . "¶\n";
Expected result:
----------------
Both memory_get_usage() should show nearly the same values.
Actual result:
--------------
1732656¶ // ~ 2 MB
43809696¶ // ~ 43 MB
--
Edit bug report at http://bugs.php.net/?id=42509&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=42509&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=42509&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=42509&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42509&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=42509&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=42509&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=42509&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=42509&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=42509&r=support
Expected behavior: http://bugs.php.net/fix.php?id=42509&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=42509&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=42509&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42509&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42509&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42509&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=42509&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=42509&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=42509&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=42509&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=42509&r=mysqlcfg