#42509 [Asn]: GMP without gmp_init eats memory

From: Date: Mon, 03 Sep 2007 14:25:12 +0000
Subject: #42509 [Asn]: GMP without gmp_init eats memory
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-117046@lists.php.net to get a copy of this message
ID: 42509 Updated by: nlopess@php.net Reported By: thomas dot hebinck at digionline dot de Status: Assigned Bug Type: Math related Operating System: Linux PHP Version: 5.2.4 Assigned To: stas New Comment: Stas: what do you think about this patch: http://web.ist.utl.pt/nuno.lopes/php_gmp_bug42509.txt Previous Comments: ------------------------------------------------------------------------ [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] thomas dot hebinck at digionline dot de 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 http://bugs.php.net/?id=42509&edit=1

« previous php.bugs (#117046) next »