Page 1 of 1

How to deallocate the Image memory

Posted: 2013-03-07T21:42:38-07:00
by wizards
Hello,

I want to read a max of 4 (Some times < 4 also) images and should display them simultaneously. If I read two then images will display horizontally i.e one on top and other on bottom. If I read 4 then 4 images will display on 4 parts of monitor. I did this using VC++.

To store 4 images i took an array of Images like

Image m_Image[4].

First time if I read 4 images then it takes memory for 4 images. Suppose if one image takes 1MB then for 4 images 4MB.
Second time if I read only two then my application is not realizing the other two images memory.

I want to release memory of the m_Image array before reading second time.

I did not find any method on Magick++ API to clear memory. I can't replace the array with pointers because i need to change lot of code.

Can you suggest me the nice way to clear memory?

Can you please help me how to clear memory.

Re: How to deallocate the Image memory

Posted: 2013-03-09T00:54:42-07:00
by tc33
This is more a C++ question than an ImageMagick question. That said, why not put the Images into a std::vector, and clear the vector each time before populating it?