I have found memory leak when exporting dicom file as .png files by using dcmtk 3.6.3.
Issue was reported as a 90% source of memory leak by using DebugDiag2 Memory leak analysis.
After that I have monitored memory usage in Visual Studio Memory usage profiler (enabled Heap analysis) and found increasing amount of instances of structures (declared as png_info *info_ptr) in DiPNGPlugin::write.
see dcmimage\libsrc\dipipng.cc
original line of code that causes the issue
// finish
png_destroy_write_struct( &png_ptr, NULL );
To fix this issue following patch must be applied:
// finish
png_destroy_write_struct( &png_ptr, &info_ptr);
Thank you very much for the bug report. I can confirm that the memory leak is present and that your proposed patch fixes the problem.
The memory leak has been present since the introduction of class DiPNGPlugin with DCMTK 3.5.3 in 2004.
The leak has been fixed now with commit #dd3d2034a, which should appear in the public git in a few days.