Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory Leak #24

Open
cesaric opened this issue Jun 27, 2011 · 0 comments
Open

Memory Leak #24

cesaric opened this issue Jun 27, 2011 · 0 comments

Comments

@cesaric
Copy link
Member

cesaric commented Jun 27, 2011

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant