<div dir="ltr">Dear All,<div><br></div><div>Yesterday I  build ITK project by using MFC frist time.</div><div><br></div><div>It is weird.  </div><div><br></div><div>I only try to do such as:</div><div><br></div><div>std::string szPathName = "...  ...";//get Dicom files Directory </div><div>GDCMSeriesFileNames::Pointer spNamesGenerator = GDCMSeriesFileNames::New();</div><div>spNamesGenerator->SetInputDirectory(szPathName);</div><div><br></div><div>then end my program, which not any other operations. But the <span style="color:black;font-family:Verdana,sans-serif;font-size:10.5pt">_CrtDumpMemoryLeaks dump so much blocks reporting memory leaks.</span></div><div><span style="color:black;font-family:Verdana,sans-serif;font-size:10.5pt"><br></span></div><div><span style="color:black;font-family:Verdana,sans-serif;font-size:10.5pt">I check ITK source code carefully. find it happen in following functions:</span></div><div><font color="#000000" face="Verdana, sans-serif"><span style="font-size:14px">____________________________________________________________________</span></font></div><div><font color="#000000" face="Verdana, sans-serif"><span style="font-size:14px">void GDCMSeriesFileNames::SetInputDirectory (std::string const &name) , then into</span><br></font></div><div><font color="#000000" face="Verdana, sans-serif"><span style="font-size:14px">void SerieHelper::SetDirectory(std::string const &dir, bool recursive) ,then into</span><br></font></div><div><font color="#000000" face="Verdana, sans-serif"><span style="font-size:14px">void SerieHelper::AddFileName(std::string const &filename), then into</span><br></font></div><div><font color="#000000" face="Verdana, sans-serif"><span style="font-size:14px">bool File::Load( ) , then into</span><br></font></div><div><font color="#000000" face="Verdana, sans-serif"><span style="font-size:14px">bool Document::Load(  ),  then into</span><br></font></div><div><font color="#000000" face="Verdana, sans-serif"><span style="font-size:14px">bool Document::DoTheLoadingDocumentJob(  )  then into</span><br></font></div><div><font color="#000000" face="Verdana, sans-serif"><span style="font-size:14px">... ... ... ...</span></font></div><div><font color="#000000" face="Verdana, sans-serif"><span style="font-size:14px">SeqEntry* DocEntrySet::NewSeqEntry(uint16_t group, uint16_t elem)</span><br></font></div><div><font color="#000000" face="Verdana, sans-serif"><span style="font-size:14px"><br></span></font></div><div><font color="#000000" face="Verdana, sans-serif"><span style="font-size:14px">finally, check NewSeqEntry function:</span></font></div><div><font color="#000000" face="Verdana, sans-serif"><span style="font-size:14px"><br></span></font></div><div><font color="#000000" face="Verdana, sans-serif"><span style="font-size:14px"><div>SeqEntry* DocEntrySet::NewSeqEntry(uint16_t group, uint16_t elem) </div><div>{</div><div>   DictEntry *dictEntry = GetDictEntry(group, elem, "SQ");</div><div>   gdcmAssertMacro(dictEntry);</div><div><br></div><div>   SeqEntry *newEntry = new SeqEntry( dictEntry );</div><div>   if (!newEntry)</div><div>   {</div><div>      gdcmWarningMacro( "Failed to allocate SeqEntry");</div><div>      return 0;</div><div>   }</div><div>   return newEntry;</div><div>}</div></span></font></div><div><font color="#000000" face="Verdana, sans-serif"><span style="font-size:14px"><br></span></font></div><div><font color="#000000" face="Verdana, sans-serif"><span style="font-size:14px"><br></span></font></div><div> <span style="color:black;font-family:Verdana,sans-serif;font-size:10.5pt">_CrtDumpMemoryLeak </span><font color="#000000" face="Verdana, sans-serif"><span style="font-size:14px">tell me </span></font><span style="color:rgb(0,0,0);font-family:Verdana,sans-serif;font-size:14px"> "SeqEntry *newEntry = new SeqEntry( dictEntry );" make these leaks happen.</span></div><div><span style="color:rgb(0,0,0);font-family:Verdana,sans-serif;font-size:14px"><br></span></div><div><span style="color:rgb(0,0,0);font-family:Verdana,sans-serif;font-size:14px">but I check every relevant ITK code ,ITK don't do anything wrong , they release all that objects they need to release before  </span> <span style="color:black;font-family:Verdana,sans-serif;font-size:10.5pt">_CrtDumpMemoryLeak is called when program exit</span><span style="color:rgb(0,0,0);font-family:Verdana,sans-serif;font-size:14px">.</span></div><div><span style="color:rgb(0,0,0);font-family:Verdana,sans-serif;font-size:14px"><br></span></div><div><span style="color:rgb(0,0,0);font-family:Verdana,sans-serif;font-size:14px">So I confused.  There is any chance  that </span> <span style="color:black;font-family:Verdana,sans-serif;font-size:10.5pt">_CrtDumpMemoryLeak make a mistake ?</span></div><div><span style="color:black;font-family:Verdana,sans-serif;font-size:10.5pt"><br></span></div><div><font color="#000000" face="Verdana, sans-serif"><span style="font-size:14px">At last, I use Visual Leak Detector</span></font><span style="color:rgb(0,0,0);font-family:Verdana,sans-serif;font-size:14px"> </span><font color="#000000" face="Verdana, sans-serif"><span style="font-size:14px">check it again. VLD give me something maybe valueable:</span></font></div><div><font color="#000000" face="Verdana, sans-serif"><span style="font-size:14px">___________________________________________________________________</span></font></div><div><font color="#000000" face="Verdana, sans-serif"><span style="font-size:14px"><div>  Leak Hash: 0x05D5522E, Count: 1, Total 16 bytes</div><div>  Call Stack (TID 46040):</div><div>    e:\program files (x86)\microsoft visual studio 11.0\vc\include\xmemory0 (592): nodeItkLib.dll!std::allocator<std::_Container_proxy>::allocate</div><div>    e:\program files (x86)\microsoft visual studio 11.0\vc\include\xstring (671): nodeItkLib.dll!std::_String_alloc<0,std::_String_base_types<char,std::allocator<char> > >::_Alloc_proxy + 0xF bytes</div><div>    e:\program files (x86)\microsoft visual studio 11.0\vc\include\xstring (650): nodeItkLib.dll!std::_String_alloc<0,std::_String_base_types<char,std::allocator<char> > >::_String_alloc<0,std::_String_base_types<char,std::allocator<char> > > + 0xA bytes</div><div>    e:\program files (x86)\microsoft visual studio 11.0\vc\include\xstring (749): nodeItkLib.dll!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::basic_string<char,std::char_traits<char>,std::allocator<char> > + 0x3E bytes</div><div>    e:\itk_vtk_dicom\i_vtk\itk320\insighttoolkit-3.20.1\utilities\gdcm\src\gdcmdocentry.cxx (39): nodeItkLib.dll!gdcm::DocEntry::DocEntry + 0x57 bytes</div><div>    e:\itk_vtk_dicom\i_vtk\itk320\insighttoolkit-3.20.1\utilities\gdcm\src\gdcmseqentry.cxx (40): nodeItkLib.dll!gdcm::SeqEntry::SeqEntry + 0x3B bytes</div><div>    e:\itk_vtk_dicom\i_vtk\itk320\insighttoolkit-3.20.1\utilities\gdcm\src\gdcmdocentryset.cxx (526): nodeItkLib.dll!gdcm::DocEntrySet::NewSeqEntry + 0x2F bytes</div><div>    e:\itk_vtk_dicom\i_vtk\itk320\insighttoolkit-3.20.1\utilities\gdcm\src\gdcmdocument.cxx (2404): nodeItkLib.dll!gdcm::Document::ReadNextDocEntry + 0x18 bytes</div><div>    e:\itk_vtk_dicom\i_vtk\itk320\insighttoolkit-3.20.1\utilities\gdcm\src\gdcmdocument.cxx (1013): nodeItkLib.dll!gdcm::Document::ParseDES + 0xD bytes</div><div>    e:\itk_vtk_dicom\i_vtk\itk320\insighttoolkit-3.20.1\utilities\gdcm\src\gdcmdocument.cxx (186): nodeItkLib.dll!gdcm::Document::DoTheLoadingDocumentJob</div><div>    e:\itk_vtk_dicom\i_vtk\itk320\insighttoolkit-3.20.1\utilities\gdcm\src\gdcmdocument.cxx (123): nodeItkLib.dll!gdcm::Document::Load</div><div>    e:\itk_vtk_dicom\i_vtk\itk320\insighttoolkit-3.20.1\utilities\gdcm\src\gdcmfile.cxx (151): nodeItkLib.dll!gdcm::File::Load + 0xA bytes</div><div>    e:\itk_vtk_dicom\i_vtk\itk320\insighttoolkit-3.20.1\utilities\gdcm\src\gdcmseriehelper.cxx (99): nodeItkLib.dll!gdcm::SerieHelper::AddFileName</div><div>    e:\itk_vtk_dicom\i_vtk\itk320\insighttoolkit-3.20.1\utilities\gdcm\src\gdcmseriehelper.cxx (249): nodeItkLib.dll!gdcm::SerieHelper::SetDirectory + 0x1D bytes</div><div>    e:\itk_vtk_dicom\i_vtk\itk320\insighttoolkit-3.20.1\code\io\itkgdcmseriesfilenames.cxx (82): nodeItkLib.dll!itk::GDCMSeriesFileNames::SetInputDirectory</div><div>  ...  ...  ...  ...</div><div><br></div><div>  Data:</div><div>    00 89 82 04    00 00 00 00    00 00 00 00    00 00 00 00     ........ ........</div><div><br></div><div>______________________________________________________</div><div><br></div><div>above mensioned segment is one of VLD dumped. it is look like some leaks happen in SeqEntry's base class DocEntry,some STL string or list container. It's any possible that STL inside problem  lead to these upper leaks??? I guess... ...<br></div><div><br></div><div>Anyway , I can't enough time to find the answer out by time limit for a project. If anybody understand what exactly happen here. pls kindly share with me. Thank a lot.</div></span></font></div><div><font color="#000000" face="Verdana, sans-serif"><span style="font-size:14px"><br></span></font></div><div><font color="#000000" face="Verdana, sans-serif"><span style="font-size:14px"> </span></font></div><div><span style="color:rgb(0,0,0);font-family:Verdana,sans-serif;font-size:14px">Thanks & Bast Regards,</span></div><div><span style="color:rgb(0,0,0);font-family:Verdana,sans-serif;font-size:14px">Micah Liu</span></div><div><span style="color:rgb(0,0,0);font-family:Verdana,sans-serif;font-size:14px"><br></span></div></div>