Details
Description
The following iteration shows increasing memory usage:
$manager = Doctrine_Manager::getInstance();
$manager->setAttribute(Doctrine::ATTR_USE_DQL_CALLBACKS, true);
$manager->....connection....
for($i=0; $i<10;$i++) {
$tx = Doctrine_Query::create()
->from('Some_Entity cot')
->andWhere('cot.id = ?', $someid)
->fetchOne();
$usage = memory_get_usage();
echo $i.': '.$usage."\n";
}
This results in an exceed-max-memory-fatal (750 MB) with a more complex application i am running that iterates >20,000 times.
I found out that there is a memory leak in Doctrine_Query_Abstract._getDqlCallbackComponents():
... $copy->getSqlQuery($params); $componentsAfter = $copy->getQueryComponents(); $copy->free(); //This is the solution ...
Sincerly,
Markus