ALL,
I have MSVC 2017 and I have VLD installed.
Sometimes MSVC reports memory leaks, but VLD says "No memory leaks detected!"
Who is correct?
TIA!
Related
i have a relative big C++ project which i can compile in vs2015 with no problems at all,
when i tried to compiled it in vs2017 i get the problem:
fatal error C1060: compiler is out of heap space
when monitoring the cl.exe process it gets to 3.5G and then crush with this message,
the compiled application is x64 but the compiler is by default 32bit
after some googling i added this flag:
set PreferredToolArchitecture=x64
devenv.exe
and its used the 64bit compiler which works but suck all my memory (30G+) and make compilation super slow... :(
why its happening and what can i do ? in vs2015 exactly same project was compiling at no time and almost no memory consumption at all (relatively)
thanks for any help!
(P.S i tried the /zm200 /zm1000 /zm2000 flags, doesnt seems to change anything)
I understand that heap corruption can happen from wide variety of causes.
I have a QT C++ project in Visual Studio. If I run in Debug or Release mode from Visual Studio, everything goes smoothly.
If I run the released executable (outside of Visual Studio), I get an application has stopped working error, followed by a prompt that asks if I want to Debug. This brings up Visual Studio Just-in-Time Debugger window stating that: An unhandled win32 exception occured in my_qt_application.exe[8812]
If I choose to Debug, I get the message: Unhandled exception at (...) (ntdll.dll) (...) A heap has been corrupted.
So I keep searching in the code for causes. The problem is that this error happens at very random occasions, not very consistent.
My question is; can the cause of this be missing dlls? (I've added the dlls that allows the program to run.)
No. The cause cannot be missing dlls. It could be a proximate cause. Example: If some image plugins are not available, and your code doesn't check that QImage loading had succeeded, and then tries to operate on the null image - there may be problems.
Most likely, though, you have a plain old memory error that you should squish using e.g. Valgrind.
I am trying to run a program I compiled in Visual Studio 2013. However, I get the error
The program can't start because MSVCP110D.dll is missing from
your computer. Try reinstalling the program to fix this problem.
This is not a very helpful error. However, after some Googling, I found that it is (apparently) trying to load a standard c++ library dynamically, and that to get around this I need to specify the /MT option rather than the /MD option. This leaves me with a number of questions:
What exactly is that doing?
What are the benefits of /MD as opposed to /MT? I mean, there must be a reason that it is the default options...
How would I go about getting the looked for .dll and getting Visual Studio to use it? I downloaded this, but honestly don't know exactly how to use it.
Most importantly, how to I get that error to go away and my program to run?
Some additional info: I am compiling in Release mode using an x64 build.
The problem is that you are mixing different versions of Visual Studio by using Qt that was compiled using a different compiler. Remember that each version of Visual Studio will have its own runtime/CRT. The Qt dlls that were compiled with Visual Studio 2012 and will be dependent on the Visual Studio 2012 runtime. They will not use the 2013 runtime.
The solution to this problem is to recompile all of your code and dependent libraries/dlls with the same compiler.
Warning:
Some users will try to just install the dynamic runtime (or recompile dependent libraries with static CRT) from the other version of Visual Studio however this is not a solution to this problem mainly because each runtime has its own independent heap. Having separate heaps can and will lead to random crashes caused by allocating memory in one heap and then trying to free it in a different heap. Since the heaps do not share information about allocations or deallocations this leads to having corrupt heaps. From my experience the problem does not always cause an instant crash. The crash may or may not happen on the next allocation of the corrupt heap so debugging this situation can be very frustrating.
I'm using Crypto++ library in my project but I've the following message:
In memory integrity check failed. This may be caused by debug
breakpoints or DLL relocation.
And Visual Leak Detector detect lots of memory leaks, but I'll dctor are corectly called.
I've build Crypto with msvc-2010 (MultiByte) and I'm using cryptopp from anothre library (UNICODE)
Is this dangerous?
In memory integrity check failed.
It sound like you are using one of the pre-built FIPS libraries available for the Crypto++ website. (That's where I've seen this most often).
If so, you need to develop your program with the same version that was used to build the DLL. That's probably Visual Studio 6, or Visual Studio 2002/2003 or so. You will have lots of memory problems if you try to use it with Visual Studio 2010 ro 2012.
And Visual Leak Detector detect lots of memory leaks, but I'll dctor are corectly called.
Ignore these. Microsoft has an unfixed bug in that damn thing dating back to the Visual Studio 6 days. You can find the bug report if you search Microsoft Connect. Its talked about on the Leak page from the Crypto++ wiki.
I've build Crypto with msvc-2010 (MultiByte) and I'm using cryptopp from anothre library (UNICODE)
The other library must be built using Visual Studio 2010 also. UNICODE is OK, but you will need to handle the MBCS/UNICODE conversions. See Character Set Considerations on the Crypto++ wiki.
I have warnings as errors turned on and the warning level cranked up to the max. I've integrated VLD in my unit tests. When I purposefully create memory leaks, VLD prints a warning in the Visual Studio output console and the warnings console.
The warning is formatted like warning : Visual Leak Detector detected memory leaks!
However, Visual Studio reports that the build succeeds. Is warnings as errors limited to Visual Studio generated warnings?
Yes, the "warnings are errors" is a compiler setting, which basically says "If (error_level == warning) error_level = error;" inside the compiler.