Hi all,
I have written some command line tool using Yiic to process some large amount of database records. This is working just fine.
However, I'm running into some PHP memory management issues.
For exemple, I'm using that kind of code to process records :
$dataReader=$this->connection_db->createCommand("SELECT * FROM MyTable")->query(); while(($row=$dataReader->read())!==false) { $command2=$this->connection_db->createCommand("SELECT * FROM MyTable2 WHERE id=:id"); $command2->bindParam(":id",$row['Ext_Id'],PDO::PARAM_STR); $row2=$command2->queryRow(); // Do some usefull stuff unset($row2, $command2); }
Even if objects are released by an unset command, memory just grow on and on (can be checked by a call to memory_get_usage).
So, my question is : Is there a best practice to correctly release those DAO to avoid this issue?
Thank you for your help.