Page 1 of 1

how to destory image ?

Posted: 2011-10-27T12:48:34-07:00
by ulao
I have this in a loop

Image image(mWidth,mHeight,"RGB",CharPixel,rgbImage);
image.rotate(90);
image.write(0,0,mHeight,mWidth,"RGB",CharPixel,pushImage);

Memory is not being freed up and I dont quite understand how to do so?

This also does not work

Image * image;
image = new Image(mWidth,mHeight,"RGB",CharPixel,rgbImage);
image->rotate(90);
image->write(0,0,mHeight,mWidth,"RGB",CharPixel,pushImage);
delete image;

I though the imagemagick manual says its not need but that is not the case here.

Re: how to destory image ?

Posted: 2011-10-27T17:09:49-07:00
by magick
De-referenced images are automagically deleted. Run your code in a loop for example 1000 iterations. If the memory stays more or less constant, it suggests the image is deleted as expected. If the memory consumption uniformly increases, that suggests a memory leak.

Re: how to destory image ?

Posted: 2011-10-28T04:45:45-07:00
by ulao
UPDATE:: Never mind, something unrelated, over looked.
De-referenced images are automagically deleted. Run your code in a loop for example 1000 iterations. If the memory stays more or less constant, it suggests the image is deleted as expected. If the memory consumption uniformly increases, that suggests a memory leak.
- This is precisely how I arrived at this quandary.