memory leak when resize gif
Posted: 2010-03-03T19:12:29-07:00
I found that if the gif file contains lots of frames, seems that some memory did not release after resized.Here is the simple code
list<Image> imageList;
list<Image> coalescedList;
readImages(&imageList, src);
coalesceImages(&coalescedList, imageList.begin(), imageList.end());
list<Image>::iterator it = coalescedList.begin();
string size = "300x200";
while(it != coalescedList.end()){
Image& image = (*it);
image.filterType(BoxFilter);//using a easy filter
image.zoom(size);
image.quality(90);
++it;
}
writeImages(coalescedList.begin(), coalescedList.end(),dst);
cout<<"resize gif finish"<<endl;
char c;
cin>>c;
the original gif file is here "http://fmn.xnimg.cn/fmn041/20100304/085 ... gif",which contains 193 frames
when the program print "resize gif finish", I see the process using about 500M memory and don't release after a long time. I don't know this is a bug or ImageMagick use a memory pool, if it use
a memory pool. then is there any method to release the memory as soon as possible? Thanks very much
list<Image> imageList;
list<Image> coalescedList;
readImages(&imageList, src);
coalesceImages(&coalescedList, imageList.begin(), imageList.end());
list<Image>::iterator it = coalescedList.begin();
string size = "300x200";
while(it != coalescedList.end()){
Image& image = (*it);
image.filterType(BoxFilter);//using a easy filter
image.zoom(size);
image.quality(90);
++it;
}
writeImages(coalescedList.begin(), coalescedList.end(),dst);
cout<<"resize gif finish"<<endl;
char c;
cin>>c;
the original gif file is here "http://fmn.xnimg.cn/fmn041/20100304/085 ... gif",which contains 193 frames
when the program print "resize gif finish", I see the process using about 500M memory and don't release after a long time. I don't know this is a bug or ImageMagick use a memory pool, if it use
a memory pool. then is there any method to release the memory as soon as possible? Thanks very much