[Insight-users] itk::GDCMSeriesFileNames memory leaks with MFC

Lyubomir G. Zagorchev Lyubomir.G.Zagorchev at Dartmouth.edu
Thu Feb 12 12:29:11 EST 2009


Hi Mathieu,

I am using ITK as a static library (BUILD_SHARED_LIBS OFF) , it doesn't get loaded as a dll. I just double-checked in the output window and I don't see any other ITK dlls.  I am pretty sure that the problem is caused by string assignment/allocation (vector<std::string>). 

Thanks,

Lyubomir

--- Mathieu Malaterre wrote:
> Reading DICOM series with itk::GDCMSeriesFileNames causes a memory leak with MFC. I am running the CVS version of ITK on XP with a vtkMFCWindow based GUI. There is something in the string allocation that causes the leakage. The leaks correspond with the number of files in the series.  I don't want to use AfxEnableMemoryTracking(FALSE) before reading a DICOM volume with itk::GDCM... Please help!
>
> typedef itk::GDCMSeriesFileNames NamesGeneratorType;
> NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New();
> nameGenerator->SetUseSeriesDetails(true);
> nameGenerator->SetDirectory(dirname);  // when commented out there is no memory leak

Try rerunning your example with the /delayload flag to avoid having
ITK dll being loaded before MFC's one. Please report back if you are
convinced that there is a leaks in gdcm library.

Thanks,
-- 
Mathieu
--- end of quote ---



More information about the Insight-users mailing list