Bug #46353 [Fbk->NoF]: string concatenation leaks memory when using execute
| From: | php-bugs at lists dot php dot net | Date: | Mon, 18 Feb 2013 00:33:55 +0000 |
| Subject: | Bug #46353 [Fbk->NoF]: string concatenation leaks memory when using execute | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-176729@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=46353&edit=1
ID: 46353
Updated by: php-bugs@lists.php.net
Reported by: anders at freeones dot com
Summary: string concatenation leaks memory when using execute
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: Scripting Engine problem
Operating System: Linux 2.6.20-1.2320
PHP Version: 5.2.6
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2010-11-02 17:33:20] felipe@php.net
Please try using this snapshot:
http://snaps.php.net/php5.3-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
------------------------------------------------------------------------
[2010-08-18 12:31:07] andrey@php.net
not a mysql thing, still no feedback
------------------------------------------------------------------------
[2008-11-03 01:00:04] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2008-10-26 11:12:34] jani@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
------------------------------------------------------------------------
[2008-10-21 08:15:21] anders at freeones dot com
Description:
------------
I run some code 5 million itteration yesterday, today I change my string building to use single
quotes and the dot operator. That version was able to do aprox 25k itterations then the script died
due memory leak.
Reproduce code:
---------------
# Makign a string like this leaks NOT memory
# $lInsert = "Insert into {$this->mTable}
(datetime,entity_id,entity_type,domain,country,location,raws,uniques)" .
# " values
('{$this->getDateTime()}',{$this->getEntityId()},{$this->getEntityType()},{$this->getDomain()},"
.
#
"{$this->getCountry()},{$this->getLocation()},{$this->getRaws()},{$this->getUniques()});";
# Making a string liek this leaks memory when doign execute
$lInsert = 'Insert into '.$this->mTable.'
(datetime,entity_id,entity_type,domain,country,location,raws,uniques)' .
' values
("'.$this->getDateTime().'",'.$this->getEntityId().','.$this->getEntityType().','.$this->getDomain().','
.$this->getCountry().','.$this->getLocation().','.$this->getRaws().','.$this->getUniques().');';
# $lInsert = "Insert into {$this->mTable}
(datetime,entity_id,entity_type,domain,country,location,raws,uniques)" .
# " values
('{$lTimeStamp}',{$lEntityId},{$lEntityType},{$lDomain},{$lCountry},{$lLocation},{$lRaws},{$lUniques})";
#
print memory_get_usage()."\n";
$lStatement =& $this->mDbh->prepare($lInsert);
if (MDB2::isError($lStatement)){
error_log($lStatement->getMessage().';query:'.$lInsert.'
'.$lStatement->userinfo);
$lResult = false;
} else {
$lResult =& $lStatement->execute();
$lStatement->free();
}
Expected result:
----------------
See code comments
Actual result:
--------------
see code comments
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=46353&edit=1