Code: Select all
#include <list>
#include <Magick++.h>
int main(int argc, char** argv) {
char *filename = argv[1];
std::list<Magick::Image> imageList;
readImages(&imageList, filename);
return 0;
}
(test image : http://wstatic.naver.com/w9/lg_naver_v3.gif)
(Linux 2.6.18-53.1.14.el5 x86_64 GNU/Linux, ImageMagick 6.5.5-10)
this is valgrind report
Code: Select all
==2991== Memcheck, a memory error detector.
==2991== Copyright (C) 2002-2006, and GNU GPL'd, by Julian Seward et al.
==2991== Using LibVEX rev 1658, a library for dynamic binary translation.
==2991== Copyright (C) 2004-2006, and GNU GPL'd, by OpenWorks LLP.
==2991== Using valgrind-3.2.1, a dynamic binary instrumentation framework.
==2991== Copyright (C) 2000-2006, and GNU GPL'd, by Julian Seward et al.
==2991== For more details, rerun with: -v
==2991==
==2991==
==2991== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 5 from 1)
==2991== malloc/free: in use at exit: 45,662 bytes in 1,454 blocks.
==2991== malloc/free: 1,665 allocs, 211 frees, 456,165 bytes allocated.
==2991== For counts of detected errors, rerun with: -v
==2991== searching for pointers to 1,454 not-freed blocks.
==2991== checked 1,220,648 bytes.
==2991==
==2991== 128 (64 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record 5 of 21
==2991== at 0x4A05809: malloc (vg_replace_malloc.c:149)
==2991== by 0x4C9AC2: NewLinkedList (hashmap.c:1409)
==2991== by 0x4B46E1: GetExceptionInfo (exception.c:423)
==2991== by 0x41781A: void Magick::readImages<std::list<Magick::Image, std::allocator<Magick::Image> > >(std::list<Magick::Image, std::allocator<Magick::Image> >*, std::string const&) (in /home1/irteam/src/nivfs/a.out)
==2991== by 0x4171FC: main (in /home1/irteam/src/nivfs/a.out)
==2991==
==2991== LEAK SUMMARY:
==2991== definitely lost: 64 bytes in 1 blocks.
==2991== indirectly lost: 64 bytes in 1 blocks.
==2991== possibly lost: 0 bytes in 0 blocks.
==2991== still reachable: 45,534 bytes in 1,452 blocks.
==2991== suppressed: 0 bytes in 0 blocks.
==2991== Reachable blocks (those to which a pointer was found) are not shown.
==2991== To see them, rerun with: --show-reachable=yes