succeed.
Press any key to continue . . .
Press any key to continue . . .
If I don’t comment the first line, I get: C:\Misc\Tester\tester.cpp(1): fatal error C1083: Cannot open include file: ‘stdafx.h’: No such file or directory
Microsoft Visual Studio Community 2015 Version 14.0.25431.01 Update 3
Windows 10 x64 Version 19.03
ITK-5.0.1 (built with static libraries - I don’t know whether that matters)
CMake 3.15.5 (but CMake version probably doesn’t matter)
Hi Dzenan,
tks! I don’t know why I still have the memory leaks.
Just one difference (I don’t know if it is a big difference), ITK 5.0.1 has been built has shared libraries (.dlls).
Could you please try this way?
Tks
False positives
_CrtDumpMemoryLeaks can give false indications of memory leaks if a library marks internal allocations as normal blocks instead of CRT blocks or client blocks. In that case, _CrtDumpMemoryLeaks is unable to tell the difference between user allocations and internal library allocations. If the global destructors for the library allocations run after the point where you call _CrtDumpMemoryLeaks, every internal library allocation is reported as a memory leak. Versions of the Standard Template Library earlier than Visual Studio .NET may cause _CrtDumpMemoryLeaks to report such false positives.
At the point _CrtDumpMemoryLeaks() is run, even the reader smart pointer is not released much less dynamic library resources. I don’t think this tool will easily work with shared libraries and the complicated order of when static objects are destroyed across libraries.
With VS2019, and ITK-master af89589, built with shared libraries, I get no leaks either:
BMPImageIO : Magic Number Fails = O : b
succeed.
Press any key to continue . . .
C:\Misc\Tester\Debug\tester.exe (process 37516) exited with code 0.
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
Press any key to close this window . . .
Now I don’t use anymore a Win 32 Console Application but a single document MFC Application for x64.
In this way I don’t call _CrtDumpMemoryLeaks(); MFCApplication.zip (135.0 KB)
I have Windows 10 1903 and ITK 5.0.1 (the source .zip file downloaded from here Download | ITK) built using CMake 3.15.3 for x64 platform using default options, the only custom option I used was to build as shared library and not as static library .
If you build the application, run and close in debug mode (of course) you should see the memory leaks I’m still having. Use the debug x64 for building the application.
In a previous answer you told me that you used Visual Studio 2015 community, so could you please try this application and tell me if you get the same memory leaks?
Tks a lot,
Lorenzo
P.S. naturally you have to change the directories (c++ and .lib) in the project settings.