ID:               46353
 Updated by:       [EMAIL PROTECTED]
 Reported By:      anders at freeones dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         MySQL related
 Operating System: Linux 2.6.20-1.2320
 PHP Version:      5.2.6
 New Comment:

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.




Previous Comments:
------------------------------------------------------------------------

[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/?id=46353&edit=1

Reply via email to