Edit report at http://bugs.php.net/bug.php?id=46353&edit=1

 ID:                 46353
 Updated by:         [email protected]
 Reported by:        anders at freeones dot com
 Summary:            string concatenation leaks memory when using execute
 Status:             No Feedback
 Type:               Bug
-Package:            MySQL related
+Package:            Scripting Engine problem
 Operating System:   Linux 2.6.20-1.2320
 PHP Version:        5.2.6
 Block user comment: N

 New Comment:

not a mysql thing, still no feedback


Previous Comments:
------------------------------------------------------------------------
[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] [email protected]

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 http://bugs.php.net/bug.php?id=46353&edit=1

Reply via email to