-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Memory leak in Doctrine (http://www.doctrine-project.org/jira/browse/DC-310). Did some image resizing (images were saved as BLOBS in the DB table) and noticed it immediately with the createThumbnailImages() function below. Uncommenting "Doctrine_Manager::connection()->clear();" fixes it.
public function createThumbnailImages($params)
{
$width = $params["columns"];
$height = $params["rows"];
$q = Doctrine_Query::create()->select('pi.id')->from('ProductImage pi');
$results = $q->execute();
$image = new Gmagick();
$prodImageTable = Doctrine_Core::getTable('ProductImage');
foreach ($results as $result)
{
$imageResult = $prodImageTable->find($result->id);
$image->readimageblob($imageResult->image);
$image->scaleimage($width, $height, true); // 3rd parameter, bestFit
$imageResult->thumb = $image;
$imageResult->save();
$image->clear();
unset($imageResult);
//Doctrine_Manager::connection()->clear();
}
$image->destroy();
}
Maybe we need to implement some memory checking as Doctrine/Hydrator/Graph.php can also exceed memory limits assembling the data graph and throw an error. Maybe we create an auto paging mechanism for these cases?
Metadata
Metadata
Assignees
Labels
No labels