[Dcmlib] gdcm fuite de memoire

Mathieu Malaterre mathieu.malaterre at kitware.com
Mon Jun 7 22:18:29 CEST 2004


Salut,

	J'ai fais un coup de valgrind sur mon nouveau test lecture/ecriture de 
serie DICOM via ITK. Et je m'apercois que gdcm a des pertes de memoire:

==20624== 80964 bytes in 2249 blocks are still reachable in loss record 
6 of 10
==20624==    at 0x3C01E3D4: operator new(unsigned) (vg_replace_malloc.c:107)
==20624==    by 0x3C207835: gdcmParser::NewHeaderEntryByNumber(unsigned 
short, unsigned short) (gdcmParser.cxx:2354)
==20624==    by 0x3C207212: gdcmParser::ReadNextHeaderEntry() 
(gdcmParser.cxx:2290)
==20624==    by 0x3C2037C0: gdcmParser::LoadHeaderEntries(bool) 
(gdcmParser.cxx:1220)
==20624==    by 0x3C1FF72D: gdcmParser::gdcmParser(char const*, bool, 
bool, bool) (gdcmParser.cxx:73)
==20624==    by 0x3C1F04ED: gdcmHeader::gdcmHeader(char const*, bool, 
bool, bool) (gdcmHeader.cxx:27)
==20624==    by 0x3C1F667D: gdcmHeaderHelper::gdcmHeaderHelper(char 
const*, bool, bool, bool) (gdcmHeaderHelper.cxx:37)
==20624==    by 0x3C0EC2EF: 
itk::GDCMImageIO::InternalReadImageInformation(std::basic_ifstream<char, 
std::char_traits<char> >&) (itkGDCMImageIO.cxx:209)
==20624==    by 0x3C0EC9BE: itk::GDCMImageIO::ReadImageInformation() 
(itkGDCMImageIO.cxx:286)
==20624==    by 0x8074C2D: itk::ImageFileReader<itk::Image<unsigned 
short, 3>, itk::DefaultConvertPixelTraits<unsigned short> 
 >::GenerateOutputInformation() (itkImageFileReader.txx:126)
==20624==    by 0x3C182775: 
itk::ProcessObject::UpdateOutputInformation() (itkProcessObject.cxx:680)
==20624==    by 0x3C1833D4: 
itk::ProcessObject::UpdateLargestPossibleRegion() (itkProcessObject.cxx:991)
==20624==    by 0x806BEB0: itk::ImageSeriesReader<itk::Image<unsigned 
short, 3> >::GenerateData() (itkImageSeriesReader.txx:228)
==20624==    by 0x3C182F4F: 
itk::ProcessObject::UpdateOutputData(itk::DataObject*) 
(itkProcessObject.cxx:906)
==20624==    by 0x3C16148A: itk::DataObject::UpdateOutputData() 
(itkDataObject.cxx:423)
==20624==    by 0x3C161009: itk::DataObject::Update() 
(itkDataObject.cxx:344)
==20624==    by 0x3C182477: itk::ProcessObject::Update() 
(itkProcessObject.cxx:544)
==20624==    by 0x8060CA7: main (itkGDCMSeriesReadImageWrite.cxx:62)
==20624==
==20624==
==20624== 108192 bytes in 46 blocks are possibly lost in loss record 7 of 10
==20624==    at 0x3C01E3D4: operator new(unsigned) (vg_replace_malloc.c:107)
==20624==    by 0xBDAC48: std::__default_alloc_template<true, 
0>::allocate(unsigned) (in /usr/lib/libstdc++.so.5.0.5)
==20624==    by 0xBE0677: std::string::_Rep::_S_create(unsigned, 
std::allocator<char> const&) (in /usr/lib/libstdc++.so.5.0.5)
==20624==    by 0xBE0748: 
std::string::_Rep::_M_clone(std::allocator<char> const&, unsigned) (in 
/usr/lib/libstdc++.so.5.0.5)
==20624==    by 0xBDD6D4: 
std::string::_Rep::_M_grab(std::allocator<char> const&, 
std::allocator<char> const&) (in /usr/lib/libstdc++.so.5.0.5)
==20624==    by 0xBDD777: std::string::string(std::string const&) (in 
/usr/lib/libstdc++.so.5.0.5)
==20624==    by 0x3C2045BA: 
gdcmParser::LoadHeaderEntry(gdcmHeaderEntry*) (gdcmParser.cxx:1373)
==20624==    by 0x3C203890: gdcmParser::LoadHeaderEntries(bool) 
(gdcmParser.cxx:1233)
==20624==    by 0x3C1FF72D: gdcmParser::gdcmParser(char const*, bool, 
bool, bool) (gdcmParser.cxx:73)
==20624==    by 0x3C1F0A9F: gdcmHeader::gdcmHeader(char const*, bool, 
bool, bool) (gdcmHeader.cxx:27)
==20624==    by 0x3C1EC246: gdcmFile::gdcmFile(std::string&, bool, bool, 
bool) (gdcmFile.cxx:61)
==20624==    by 0x3C0EBFD3: itk::GDCMImageIO::Read(void*) 
(itkGDCMImageIO.cxx:190)
==20624==    by 0x80758C1: itk::ImageFileReader<itk::Image<unsigned 
short, 3>, itk::DefaultConvertPixelTraits<unsigned short> 
 >::GenerateData() (itkImageFileReader.txx:316)
==20624==    by 0x3C182F4F: 
itk::ProcessObject::UpdateOutputData(itk::DataObject*) 
(itkProcessObject.cxx:906)
==20624==    by 0x3C16148A: itk::DataObject::UpdateOutputData() 
(itkDataObject.cxx:423)
==20624==    by 0x3C161009: itk::DataObject::Update() 
(itkDataObject.cxx:344)
==20624==    by 0x3C182477: itk::ProcessObject::Update() 
(itkProcessObject.cxx:544)
==20624==    by 0x806B18B: itk::ImageSeriesReader<itk::Image<unsigned 
short, 3> >::GenerateOutputInformation() (itkImageSeriesReader.txx:78)
==20624==    by 0x3C182775: 
itk::ProcessObject::UpdateOutputInformation() (itkProcessObject.cxx:680)
==20624==    by 0x8082DB7: itk::ImageBase<3>::UpdateOutputInformation() 
(itkImageBase.txx:102)
==20624==    by 0x3C160FDF: itk::DataObject::Update() 
(itkDataObject.cxx:342)
==20624==    by 0x3C182477: itk::ProcessObject::Update() 
(itkProcessObject.cxx:544)
==20624==    by 0x8060CA7: main (itkGDCMSeriesReadImageWrite.cxx:62)
==20624==
==20624==
==20624== 191880 bytes in 5330 blocks are definitely lost in loss record 
8 of 10
==20624==    at 0x3C01E3D4: operator new(unsigned) (vg_replace_malloc.c:107)
==20624==    by 0x3C207835: gdcmParser::NewHeaderEntryByNumber(unsigned 
short, unsigned short) (gdcmParser.cxx:2354)
==20624==    by 0x3C207212: gdcmParser::ReadNextHeaderEntry() 
(gdcmParser.cxx:2290)
==20624==    by 0x3C2037C0: gdcmParser::LoadHeaderEntries(bool) 
(gdcmParser.cxx:1220)
==20624==    by 0x3C1FF72D: gdcmParser::gdcmParser(char const*, bool, 
bool, bool) (gdcmParser.cxx:73)
==20624==    by 0x3C1F04ED: gdcmHeader::gdcmHeader(char const*, bool, 
bool, bool) (gdcmHeader.cxx:27)
==20624==    by 0x3C1F667D: gdcmHeaderHelper::gdcmHeaderHelper(char 
const*, bool, bool, bool) (gdcmHeaderHelper.cxx:37)
==20624==    by 0x3C0EC2EF: 
itk::GDCMImageIO::InternalReadImageInformation(std::basic_ifstream<char, 
std::char_traits<char> >&) (itkGDCMImageIO.cxx:209)
==20624==    by 0x3C0EC9BE: itk::GDCMImageIO::ReadImageInformation() 
(itkGDCMImageIO.cxx:286)
==20624==    by 0x8074C2D: itk::ImageFileReader<itk::Image<unsigned 
short, 3>, itk::DefaultConvertPixelTraits<unsigned short> 
 >::GenerateOutputInformation() (itkImageFileReader.txx:126)
==20624==    by 0x3C182775: 
itk::ProcessObject::UpdateOutputInformation() (itkProcessObject.cxx:680)
==20624==    by 0x3C1833D4: 
itk::ProcessObject::UpdateLargestPossibleRegion() (itkProcessObject.cxx:991)
==20624==    by 0x806BEB0: itk::ImageSeriesReader<itk::Image<unsigned 
short, 3> >::GenerateData() (itkImageSeriesReader.txx:228)
==20624==    by 0x3C182F4F: 
itk::ProcessObject::UpdateOutputData(itk::DataObject*) 
(itkProcessObject.cxx:906)
==20624==    by 0x3C16148A: itk::DataObject::UpdateOutputData() 
(itkDataObject.cxx:423)
==20624==    by 0x3C161009: itk::DataObject::Update() 
(itkDataObject.cxx:344)
==20624==    by 0x3C182477: itk::ProcessObject::Update() 
(itkProcessObject.cxx:544)
==20624==    by 0x8060CA7: main (itkGDCMSeriesReadImageWrite.cxx:62)
==20624==
==20624==
==20624== 199280 bytes in 6 blocks are possibly lost in loss record 9 of 10
==20624==    at 0x3C01E3D4: operator new(unsigned) (vg_replace_malloc.c:107)
==20624==    by 0xBDB0AA: std::__default_alloc_template<true, 
0>::_S_chunk_alloc(unsigned, int&) (in /usr/lib/libstdc++.so.5.0.5)
==20624==    by 0xBDAFBC: std::__default_alloc_template<true, 
0>::_S_refill(unsigned) (in /usr/lib/libstdc++.so.5.0.5)
==20624==    by 0xBDACB7: std::__default_alloc_template<true, 
0>::allocate(unsigned) (in /usr/lib/libstdc++.so.5.0.5)
==20624==    by 0xBE0677: std::string::_Rep::_S_create(unsigned, 
std::allocator<char> const&) (in /usr/lib/libstdc++.so.5.0.5)
==20624==    by 0xBE0748: 
std::string::_Rep::_M_clone(std::allocator<char> const&, unsigned) (in 
/usr/lib/libstdc++.so.5.0.5)
==20624==    by 0xBDD6D4: 
std::string::_Rep::_M_grab(std::allocator<char> const&, 
std::allocator<char> const&) (in /usr/lib/libstdc++.so.5.0.5)
==20624==    by 0xBDD777: std::string::string(std::string const&) (in 
/usr/lib/libstdc++.so.5.0.5)
==20624==    by 0x3C204EF6: 
gdcmParser::CheckHeaderEntryVR(gdcmHeaderEntry*, std::string) 
(gdcmParser.cxx:1567)
==20624==    by 0x3C204D28: 
gdcmParser::FindHeaderEntryVR(gdcmHeaderEntry*) (gdcmParser.cxx:1525)
==20624==    by 0x3C207226: gdcmParser::ReadNextHeaderEntry() 
(gdcmParser.cxx:2291)
==20624==    by 0x3C2037C0: gdcmParser::LoadHeaderEntries(bool) 
(gdcmParser.cxx:1220)
==20624==    by 0x3C1FF72D: gdcmParser::gdcmParser(char const*, bool, 
bool, bool) (gdcmParser.cxx:73)
==20624==    by 0x3C1F04ED: gdcmHeader::gdcmHeader(char const*, bool, 
bool, bool) (gdcmHeader.cxx:27)
==20624==    by 0x3C1F667D: gdcmHeaderHelper::gdcmHeaderHelper(char 
const*, bool, bool, bool) (gdcmHeaderHelper.cxx:37)
==20624==    by 0x3C1F930D: 
gdcmSerieHeaderHelper::SetDirectory(std::string) (gdcmHeaderHelper.cxx:613)
==20624==    by 0x3C0EDBAA: 
itk::GDCMSeriesFileNames::GetInputFileNames() 
(itkGDCMSeriesFileNames.cxx:34)
==20624==    by 0x8060C26: main (itkGDCMSeriesReadImageWrite.cxx:57)
==20624==
==20624==
==20624== 482024 bytes in 55 blocks are still reachable in loss record 
10 of 10
==20624==    at 0x3C01E3D4: operator new(unsigned) (vg_replace_malloc.c:107)
==20624==    by 0xBDB0AA: std::__default_alloc_template<true, 
0>::_S_chunk_alloc(unsigned, int&) (in /usr/lib/libstdc++.so.5.0.5)
==20624==    by 0xBDAFBC: std::__default_alloc_template<true, 
0>::_S_refill(unsigned) (in /usr/lib/libstdc++.so.5.0.5)
==20624==    by 0xBDACB7: std::__default_alloc_template<true, 
0>::allocate(unsigned) (in /usr/lib/libstdc++.so.5.0.5)
==20624==    by 0xBE0677: std::string::_Rep::_S_create(unsigned, 
std::allocator<char> const&) (in /usr/lib/libstdc++.so.5.0.5)
==20624==    by 0xBE13BE: (within /usr/lib/libstdc++.so.5.0.5)
==20624==    by 0xBDDB98: std::string::string(char const*, 
std::allocator<char> const&) (in /usr/lib/libstdc++.so.5.0.5)
==20624==    by 0x3C20D6C7: 
__static_initialization_and_destruction_0(int, int) (gdcmCommon.h:84)
==20624==    by 0x3C20D78A: _GLOBAL__I__ZN6gdcmVRC2Ev (stl_map.h:120)
==20624==    by 0x3C20D7B8: (within /opt/gdcm/lib/libgdcm.so)
==20624==    by 0x3C1CF198: (within /opt/gdcm/lib/libgdcm.so)
==20624==    by 0x3C00C9F0: _dl_init_internal (in /lib/ld-2.3.2.so)
==20624==    by 0x3C000C84: (within /lib/ld-2.3.2.so)



Est-ce que quelau'un s'y ai pencher dessus ? Ou bien je dois trouver le 
probleme moi meme.

Matt
Ps: les leaks sont trop gros pour etre lies au probleme avec la STL et 
valgrind.





More information about the Dcmlib mailing list