#33249 [Opn->Bgs]: GMP functions didn't free memory
| From: | sniper@php.net | Date: | Sun, 05 Jun 2005 22:00:44 +0000 |
| Subject: | #33249 [Opn->Bgs]: GMP functions didn't free memory | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-79916@lists.php.net to get a copy of this message | ||
ID: 33249
Updated by: sniper@php.net
Reported By: s dot araya at numisys dot com dot ar
-Status: Open
+Status: Bogus
Bug Type: Math related
Operating System: Linux (Gentoo)
PHP Version: 5.0.3
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
You can achieve similar thing with any other variable, it's not GMP
related at all.
Previous Comments:
------------------------------------------------------------------------
[2005-06-05 18:15:48] s dot araya at numisys dot com dot ar
Description:
------------
Hello,
I'm using gmp library to perform a function which uses a few
operations with large integer values. My script runs in console mode
(at least four hours of processing), scanning a big mysql table and
invoking the function to calculate big integer values that are stored
in the table.
But, in case the table has a lot of rows to process, the script halt
with 'out of memory' error. Studying the problem I realized that GMP
functions didn't free memory (when I issue unset( <resource> ) ) and
continue allocate memory in every function pass. There is no gmp_free()
in php manual.
Is there any workaround to avoid the problem?
Thank you,
Sebastián Araya
Numisys S.A.
Reproduce code:
---------------
for( $i = 0; $i = 1000000; $i++)
store_calc_value( $i );
function store_calc_value( $v )
{
$a = gmp_mul( $v, "0x100000000" );
$b = gmp_mul( $a, "0x1000" );
$sql = "Insert into t (big, value) Values (";
$sql.= gmp_strval( $a ) . ", " . gmp_strval( $b ) . ")";
mysql_query( $sql );
unset( $a ); // gmp_free( $a );
unset( $b ); // gmp_free( $b );
}
Expected result:
----------------
I expect that memory has to be freed once returning from function
store_calc_value(). A simple top command in another Linux session, tell
me that php resource continue to grow.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33249&edit=1