How to deallocate the Image memory

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
wizards
Posts: 46
Joined: 2008-12-05T06:31:55-07:00

How to deallocate the Image memory

Post 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.
tc33
Posts: 40
Joined: 2012-10-21T22:10:21-07:00
Authentication code: 67789

Re: How to deallocate the Image memory

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