how to destory image ?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
ulao
Posts: 9
Joined: 2011-10-26T06:30:54-07:00
Authentication code: 8675308

how to destory image ?

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: how to destory image ?

Post 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.
ulao
Posts: 9
Joined: 2011-10-26T06:30:54-07:00
Authentication code: 8675308

Re: how to destory image ?

Post 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.
Post Reply