#33249 [Bgs-Opn]: GMP functions didn't free memory
ID: 33249 User updated by: s dot araya at numisys dot com dot ar Reported By: s dot araya at numisys dot com dot ar -Status: Bogus +Status: Open Bug Type: Math related Operating System: Linux (Gentoo) PHP Version: 5.0.3 New Comment: Also trying with: unset( variable ); variable = Null; didn't free memory neither call the garbage collector, and in every function pass I've got an increment near to 1 MB of alloc'd RAM. Previous Comments: [2005-06-06 06:10:42] s dot araya at numisys dot com dot ar You can achieve similar thing with any other variable, it's not GMP related at all. Due to the short answer I recieved, I can't understand what're you telling me... I use GMP functions 'cos I need to make more calculations that I've exposed on the example, which I can't achieve in 32 bits operations. I see that when I issue mysql_query( 'Select * from Table1 limit 0, 1000') I need to call mysql_free_result() to free memory used to store the result in memory. Consequently, with GMP functions which uses ZEND_REGISTER_RESOURCE macro in gmp.c (wrapper for GMP functions), I suppouse that the resource continue alloc'd, till a free() call releases it, according with system memory test (experienced with a simple «top» in Linux). [2005-06-06 00:00:39] [EMAIL PROTECTED] 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. [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 = 100; $i++) store_calc_value( $i ); function store_calc_value( $v ) { $a = gmp_mul( $v, 0x1 ); $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=33249edit=1
#33249 [Opn]: GMP functions didn't free memory
ID: 33249 User updated by: s dot araya at numisys dot com dot ar Reported By: s dot araya at numisys dot com dot ar Status: Open Bug Type: Math related Operating System: Linux (Gentoo) PHP Version: 5.0.3 New Comment: Also trying with: unset( variable ); variable = Null; didn't free memory neither call the garbage collector, and in every function pass I've got an increment near to 1 MB of alloc'd RAM. Previous Comments: [2005-06-07 13:43:20] s dot araya at numisys dot com dot ar Also trying with: unset( variable ); variable = Null; didn't free memory neither call the garbage collector, and in every function pass I've got an increment near to 1 MB of alloc'd RAM. [2005-06-06 06:10:42] s dot araya at numisys dot com dot ar You can achieve similar thing with any other variable, it's not GMP related at all. Due to the short answer I recieved, I can't understand what're you telling me... I use GMP functions 'cos I need to make more calculations that I've exposed on the example, which I can't achieve in 32 bits operations. I see that when I issue mysql_query( 'Select * from Table1 limit 0, 1000') I need to call mysql_free_result() to free memory used to store the result in memory. Consequently, with GMP functions which uses ZEND_REGISTER_RESOURCE macro in gmp.c (wrapper for GMP functions), I suppouse that the resource continue alloc'd, till a free() call releases it, according with system memory test (experienced with a simple «top» in Linux). [2005-06-06 00:00:39] [EMAIL PROTECTED] 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. [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 = 100; $i++) store_calc_value( $i ); function store_calc_value( $v ) { $a = gmp_mul( $v, 0x1 ); $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=33249edit=1
#33249 [NEW]: GMP functions didn't free memory
From: s dot araya at numisys dot com dot ar Operating system: Linux (Gentoo) PHP version: 5.0.3 PHP Bug Type: Math related Bug description: GMP functions didn't free memory 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 = 100; $i++) store_calc_value( $i ); function store_calc_value( $v ) { $a = gmp_mul( $v, 0x1 ); $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 bug report at http://bugs.php.net/?id=33249edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33249r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33249r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33249r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=33249r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=33249r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33249r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33249r=needscript Try newer version: http://bugs.php.net/fix.php?id=33249r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33249r=support Expected behavior: http://bugs.php.net/fix.php?id=33249r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33249r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33249r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=33249r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33249r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=33249r=dst IIS Stability: http://bugs.php.net/fix.php?id=33249r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33249r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33249r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33249r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33249r=mysqlcfg
#33249 [Bgs]: GMP functions didn't free memory
ID: 33249 User updated by: s dot araya at numisys dot com dot ar Reported By: s dot araya at numisys dot com dot ar Status: Bogus Bug Type: Math related Operating System: Linux (Gentoo) PHP Version: 5.0.3 New Comment: You can achieve similar thing with any other variable, it's not GMP related at all. Due to the short answer I recieved, I can't understand what're you telling me... I use GMP functions 'cos I need to make more calculations that I've exposed on the example, which I can't achieve in 32 bits operations. I see that when I issue mysql_query( 'Select * from Table1 limit 0, 1000') I need to call mysql_free_result() to free memory used to store the result in memory. Consequently, with GMP functions which uses ZEND_REGISTER_RESOURCE macro in gmp.c (wrapper for GMP functions), I suppouse that the resource continue alloc'd, till a free() call releases it, according with system memory test (experienced with a simple «top» in Linux). Previous Comments: [2005-06-06 00:00:39] [EMAIL PROTECTED] 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. [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 = 100; $i++) store_calc_value( $i ); function store_calc_value( $v ) { $a = gmp_mul( $v, 0x1 ); $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=33249edit=1