#29838 [Bgs->Csd]: Memory leak in sprintf argument swapping
| From: | thies@php.net | Date: | Thu, 26 Aug 2004 13:42:19 +0000 |
| Subject: | #29838 [Bgs->Csd]: Memory leak in sprintf argument swapping | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-65282@lists.php.net to get a copy of this message | ||
ID: 29838
Updated by: thies@php.net
Reported By: tim at digicol dot de
-Status: Bogus
+Status: Closed
Bug Type: Strings related
Operating System: SuSE Linux 8.2 (i586)
PHP Version: 4.3.8
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2004-08-26 15:28:00] tim at digicol dot de
(More annoying comments:)
This memory leak does *not* happen with PHP 4.3.4.
Maybe the memory leak was introduced with the bug fix for bug #26878?
------------------------------------------------------------------------
[2004-08-26 09:42:36] tim at digicol dot de
(Sorry to get on your nerves...)
Please try the other format string I commented with "No memory leak".
The memory leak really only occurs when the format string uses argument
swapping.
------------------------------------------------------------------------
[2004-08-26 09:35:12] tim at digicol dot de
Or try printf() instead:
for ($i = 1; $i <= 100000; $i++)
printf($format, $num, $location);
Leaks memory as well.
------------------------------------------------------------------------
[2004-08-26 09:31:23] tim at digicol dot de
This is *not* bogus.
Small code change - assign the sprintf() result to $x:
for ($i = 1; $i <= 100000; $i++)
$x = sprintf($format, $num, $location);
Same result, still leaks memory. I don't see 100000 temporary variables
here, just $i, $x, $format, $num, $location.
------------------------------------------------------------------------
[2004-08-26 02:04:53] iliaa@php.net
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 created 100000 temporary variables inside PHP, what do
you expect...
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/29838
--
Edit this bug report at http://bugs.php.net/?id=29838&edit=1