I have issues with symfony 1.4 a task running daily. To make simple the task download an xml then read it.
I have notice that the memory used increase between each "node" in the xml.
For instance, somewhere in the script I do that:
foreach($prd->ArtistList->Artist as $art)
{
echo "start foreach artist ", memory_get_peak_usage(1), " bytes of ram.
";
if(!$artist = ArtistTable::getInstance()->findOneByRoleAndName($art['role'], $art['name']))
{
$artist = new Artist();
$artist->role = $art['role'];
$artist->name = $art['name'];
$artist->save();
}
if(!$pha = ProductArtistTable::getInstance()->findOneByProductIdAndArtistId($prd_id, $artist->id))
{
$pha = new ProductArtist();
$pha->product_id = $prd_id;
$pha->artist_id = $artist->id;
$pha->save();
}
$pha->free(true);
$artist->free(true);
unset($pha);
unset($artist);
echo "end foreach artist ", memory_get_peak_usage(1), " bytes of ram.
";
}
unset($art);
I can see that between two memory_get_peak_usage(1) end and start, memory used increase... I don't know what else am I supose to do to keep it at a same level...
Do you have any idea how to solve that?
Thanks!