Bug #42509 [Csd]: GMP without gmp_init eats memory
| From: | azrzrqlilylrw at gmail dot com | Date: | Wed, 23 May 2012 00:19:29 +0000 |
| Subject: | Bug #42509 [Csd]: GMP without gmp_init eats memory | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-170692@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=42509&edit=1
ID: 42509
User updated by: azrzrqlilylrw at gmail dot com
Reported by: azrzrqlilylrw at gmail dot com
Summary: GMP without gmp_init eats memory
Status: Closed
Type: Bug
-Package: Math related
+Package: *General Issues
Operating System: Linux
PHP Version: 5.2.4
Assigned To: stas
Block user comment: N
Private report: N
New Comment:
vNjlttFilx <a href="http://www.jincheng.com/p90x.html">p90x
work out</a> eMtbbmTyrd http://www.jincheng.com/p90x.html
Previous Comments:
------------------------------------------------------------------------
[2007-11-01 00:48:38] stas@php.net
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Fixed in 5.3 branch.
------------------------------------------------------------------------
[2007-09-03 14:25:12] nlopess@php.net
Stas: what do you think about this patch:
http://web.ist.utl.pt/nuno.lopes/php_gmp_bug42509.txt
------------------------------------------------------------------------
[2007-09-03 10:47:10] jani@php.net
[jani@localhost php_5_2]$ sapi/cli/php t.php
79768
99792024
[jani@localhost php_5_2]$ USE_ZEND_ALLOC=0 sapi/cli/php t.php
8236
8236
------------------------------------------------------------------------
[2007-09-01 17:02:26] azrzrqlilylrw at gmail dot com
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 this bug report at https://bugs.php.net/bug.php?id=42509&edit=1