Quantcast
Channel: Visual Leak Detector for Visual C++ 2008-2015

New Post: Leak Report in an Empty project (Windows 7 64Bits + VS2010)

$
0
0
Yes, I read it.
And after I move the "#include <vld.h>" to the top of the file "stdafx.h", there is no confused report any more.
Thanks

New Post: Leak Report in an Empty project (Windows 7 64Bits + VS2010)

Created Unassigned: Application is crashing on start if VLD is used [10624]

$
0
0
Hi,

I a new to VLD. I am working on Photoshop Plugin in which I want to detect the memory leaks.

I installed the VLD 2.5.1 and included the vld.h file in main cpp file. I see that app crashes on start.

I tried in other sample console program, it did work there. But including vld,h in any Photoshop sample plugin (Comes with SDK) project, I get crash.

Please suggest!

I am attaching the screenshot of call stack.

Thanks,
R.

New Post: leak in GLSL shader...

$
0
0
Hi!

Been getting 2 leaks because of vertexShaderSource and fragmentShaderSource but have been able to delete them using:
delete[] vertexShaderSource;
delete[] fragmentShaderSource;
Been getting HEAP CORRUPTION despite by best efforts.

Is this a known problem with shaders because of glDeleteShader? Please, let me know.

Thank you !
bool Shader::loadShader(std::string shaderName, ShaderType shaderType, const char* vertexShaderFile, const char* fragmentShaderFile) {

GLuint vertexShaderID, fragmentShaderID;

m_shaderType = shaderType;

m_shaderID = glCreateProgram();

seekShader(vertexShaderFile);
char* vertexShaderSource = new char[m_shaderCodeLenght + 1];
readShader(vertexShaderFile, vertexShaderSource);

seekShader(fragmentShaderFile);
char* fragmentShaderSource = new char[m_shaderCodeLenght + 1];
readShader(fragmentShaderFile, fragmentShaderSource);

compileShader(vertexShaderID, GL_VERTEX_SHADER, vertexShaderSource);
compileShader(fragmentShaderID, GL_FRAGMENT_SHADER, fragmentShaderSource);

linkShader(m_shaderID, vertexShaderID, fragmentShaderID);

glDeleteShader(vertexShaderID);
glDeleteShader(fragmentShaderID);

delete[] vertexShaderSource;    // ???
delete[] fragmentShaderSource;    // ???

glUseProgram(0);

return true;
}

New Post: leak in GLSL shader...

$
0
0
This is most likely not related to VLD.
My educated guess is that the code in readShader reads more byte than m_shaderCodeLenght+1.
Anyway, I would suggest to not rely on char arrays when reading files and instead read into std::string and then get the char array from std::string::c_str as suggested in http://stackoverflow.com/a/2602060/600633

New Post: leak in GLSL shader...

$
0
0
Thank you for your quick answer. I started with const char* because this is what compileShader() is expecting. Following your advice, I replaced it by std::string. Here below is what I am doing now, so it can help someone else. No more memory leaks, feeling great!
bool Shader::loadShader(std::string shaderName, ShaderType shaderType, std::string vertexShaderFile, std::string fragmentShaderFile) {

GLuint vertexShaderID, fragmentShaderID;

m_shaderID = glCreateProgram();

m_shaderType = shaderType;

compileShader(vertexShaderID, GL_VERTEX_SHADER, readShader(vertexShaderFile).c_str());
compileShader(fragmentShaderID, GL_FRAGMENT_SHADER, readShader(fragmentShaderFile).c_str());

linkShader(m_shaderID, vertexShaderID, fragmentShaderID);

glDeleteShader(vertexShaderID);
glDeleteShader(fragmentShaderID);

glUseProgram(0);

return true;
}


std::string Shader::readShader(std::string shaderFile) {

std::ifstream shaderStream;
std::stringstream stringStream;

shaderStream.open(shaderFile);
stringStream << shaderStream.rdbuf();//read the file
shaderStream.close();

std::string shaderSource = stringStream.str();//str holds the content of the file
logFileStderr(VERBOSE, "Code shader program \"%s\"...\n", shaderSource.c_str());

return shaderSource;
}

New Post: Visual Leak Detector not recognising the Qt parent child relationship in detecting memory leaks

$
0
0
Hello All,
I am using link visual leak Detector (VLD)to detect the memory leaks in my C++/Qt code. Once I end the program VLD is showing

Visual Leak Detector detected 7183 memory leaks (519961 bytes).
Largest number used: 837125 bytes.
Total allocations: 5431544 bytes

1) In this context what does Largest number used mean ?

I have used VLD tool in Qt creator and Visual studio 2015. Both tools shows big list of memory leaks but most of them are not leaks due to Qt parent child relationship. It is very difficult to find the leaks in my App(around 10000 lines of code).

Is there some kind of filter tool so that I see only critial or specific errors ? Is there any alternative Memory leak detector that recognises Qt parent child relationship? Thank you.

New Post: Visual Leak Detector not recognising the Qt parent child relationship in detecting memory leaks

$
0
0
Hi!
The same problem with VLD in my Qt application. VLD detects a lot of memory leaks. My application uses Qt 5.7.1 libraries, most of leaks shows with Qt libraries.

The VLD output:
Visual Leak Detector detected 1729 memory leaks (191564 bytes).
Largest number used: 191900 bytes.
Total allocations: 314948 bytes.

Any suggestions? Thanks in advance.

Created Unassigned: 2017 support? [10625]

$
0
0
Obviously, this project is described as 2008-2015 support. But on the off chance that it would work, I tried compiling with VS 2017.

Understandably, this didn't work.

Is there a roadmap for 2017 support?

Thanks,
Mark

New Post: Support of VS2017?

$
0
0
Any plans to support the newly released Visual Studio 2017?

This is a great product and I have used it when needed on VS2012 & Vs2015. Now VS2017 calls....

New Comment on "Using Visual Leak Detector"

$
0
0
I have a native DLL which is loaded by a C# managed program and I suspect memory leaks in the native DLL. How can I use VLD to detect in memory leak in the native DLL? That native DLL allocates memorys after the function InitModule() and is supposed to withdraw all memory in calling unloadModule(). I insert VLDEnable() at the begining of initModule() function of my native DLL and VLDReportLeaks() at the end of the unloadModule() but I still can't see any report message in the output panel. Why?

Created Unassigned: VLD can't find pdb with relative path [10626]

$
0
0
I dont run my exe from the standard location in Visual Studio and have set a custom working directory vld seems to not find my PDB file even though its next to the exe.

When I turn on DBGHELP_DBGOUT the output is this:

DBGHELP: D:\SDK\Demo\SpaceSim\SpaceSim\NewSpaceSim\..\..\bin\SpaceSim_x64d.pdb - file not found
DBGHELP: D:\SDK\Demo\SpaceSim\SpaceSim\NewSpaceSim\..\..\bin\exe\SpaceSim_x64d.pdb - file not found
DBGHELP: D:\SDK\Demo\SpaceSim\SpaceSim\NewSpaceSim\..\..\bin\symbols\exe\SpaceSim_x64d.pdb - file not found
DBGHELP: .\SpaceSim_x64d.pdb - file not found
DBGHELP: .\exe\SpaceSim_x64d.pdb - file not found
DBGHELP: .\symbols\exe\SpaceSim_x64d.pdb - file not found

When I use the first path in the output in notepad to open the file it opens the file for me.

Commented Unassigned: VLD can't find pdb with relative path [10626]

$
0
0
I dont run my exe from the standard location in Visual Studio and have set a custom working directory vld seems to not find my PDB file even though its next to the exe.

When I turn on DBGHELP_DBGOUT the output is this:

DBGHELP: D:\SDK\Demo\SpaceSim\SpaceSim\NewSpaceSim\..\..\bin\SpaceSim_x64d.pdb - file not found
DBGHELP: D:\SDK\Demo\SpaceSim\SpaceSim\NewSpaceSim\..\..\bin\exe\SpaceSim_x64d.pdb - file not found
DBGHELP: D:\SDK\Demo\SpaceSim\SpaceSim\NewSpaceSim\..\..\bin\symbols\exe\SpaceSim_x64d.pdb - file not found
DBGHELP: .\SpaceSim_x64d.pdb - file not found
DBGHELP: .\exe\SpaceSim_x64d.pdb - file not found
DBGHELP: .\symbols\exe\SpaceSim_x64d.pdb - file not found

When I use the first path in the output in notepad to open the file it opens the file for me.
Comments: DBGHELP: D:\SDK\Demo\SpaceSim\SpaceSim\NewSpaceSim\\..\\..\bin\SpaceSim_x64d.pdb - file not found DBGHELP: D:\SDK\Demo\SpaceSim\SpaceSim\NewSpaceSim\\..\\..\bin\exe\SpaceSim_x64d.pdb - file not found DBGHELP: D:\SDK\Demo\SpaceSim\SpaceSim\NewSpaceSim\\..\\..\bin\symbols\exe\SpaceSim_x64d.pdb - file not found DBGHELP: .\SpaceSim_x64d.pdb - file not found DBGHELP: .\exe\SpaceSim_x64d.pdb - file not found DBGHELP: .\symbols\exe\SpaceSim_x64d.pdb - file not found some slashes were swallowed in the previous post in the paths

New Comment on "Using Visual Leak Detector"

$
0
0
I had a project run on debug version and had memory leak issue: So VLD was installed on VS2015 - and run with Remote debugger After add "vld.h" into project, but end up "exception" and could not pin point the memory leak.... Please help..... 'GyroDRAccTest.exe' (Win32): Loaded '\\TRAPEZE_V801\ProjectArea\AppTest\Debug\GyroDRAccTest.exe'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded '\\TRAPEZE_V801\ProjectArea\AppTest\Debug\GyroDRACC.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\System32\user32.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\System32\gdi32.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\System32\lpk.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\System32\usp10.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\System32\msvcrt.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded '\\TRAPEZE_V801\ProjectArea\AppTest\Debug\vld_x86.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\System32\advapi32.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\System32\sechost.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\System32\rpcrt4.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded '\\TRAPEZE_V801\ProjectArea\AppTest\Debug\dbghelp.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded '\\TRAPEZE_V801\ProjectArea\AppTest\Debug\MSVCP140D.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded '\\TRAPEZE_V801\ProjectArea\AppTest\Debug\VCRUNTIME140D.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded '\\TRAPEZE_V801\ProjectArea\AppTest\Debug\ucrtbased.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\System32\api-ms-win-core-timezone-l1-1-0.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\System32\api-ms-win-core-file-l2-1-0.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\System32\api-ms-win-core-localization-l1-2-0.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\System32\api-ms-win-core-synch-l1-2-0.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\System32\api-ms-win-core-processthreads-l1-1-1.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\System32\api-ms-win-core-file-l1-2-0.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\System32\ws2_32.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\System32\nsi.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded '\\TRAPEZE_V801\ProjectArea\AppTest\Debug\mfc140ud.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\System32\ole32.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\System32\oleaut32.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\System32\shlwapi.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\System32\imm32.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\System32\msctf.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\System32\uxtheme.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_41e6975e2bd6f2b2\comctl32.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\winsxs\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.7601.17514_none_72d18a4386696c80\GdiPlus.dll'. Symbols loaded. Visual Leak Detector read settings from: (default settings) Visual Leak Detector Version 2.5.1 installed. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\System32\cryptbase.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\System32\shell32.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Program Files\Common Files\microsoft shared\ink\tiptsf.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\System32\version.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\System32\dwmapi.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded '\\TRAPEZE_V801\ProjectArea\AppTest\Debug\zTrace32.DLL'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\System32\comdlg32.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\System32\clbcatq.dll'. Symbols loaded. 24 c5 00 00 3b 0d 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Windows\System32\oleacc.dll'. Symbols loaded. 'GyroDRAccTest.exe' (Win32): Loaded 'C:\Program Files\UPDD\TBHOOK.DLL'. Module was built without symbols. 24 c1 00 00 3f 0d 24 c1 00 00 3f 0d 24 d9 00 01 01 25 0d 24 d7 00 00 29 0d 24 d5 00 01 01 29 0d 24 d5 00 01 00 2a 0d 24 e5 00 01 00 1a 0d The thread 0x113c has exited with code 0 (0x0). The thread 0x17fc has exited with code 0 (0x0). The thread 0x46c has exited with code 0 (0x0). Detected memory leaks! Dumping objects -> {577} normal block at 0x004E0550, 32 bytes long. Data: < O > 07 CD CD CD 00 00 00 00 00 00 4F 00 CD CD CD CD {571} normal block at 0x004E0280, 32 bytes long. Data: < O > 07 CD CD CD 00 00 00 00 00 00 4F 00 CD CD CD CD {570} normal block at 0x004EB530, 64 bytes long. Data: < N N p N N > D0 02 4E 00 20 03 4E 00 70 03 4E 00 C0 03 4E 00 {564} normal block at 0x004E0500, 32 bytes long. Data: < N > 07 CD CD CD 00 00 00 00 00 00 4E 00 CD CD CD CD {557} normal block at 0x004E95A8, 12 bytes long. Data: < ~c > 10 D0 7E 63 14 01 00 00 14 01 00 00 {554} normal block at 0x004E04B0, 32 bytes long. Data: < L > 07 CD CD CD 00 00 00 00 00 00 4C 00 CD CD CD CD {548} normal block at 0x004E0460, 32 bytes long. Data: < L > 07 CD CD CD 00 00 00 00 00 00 4C 00 CD CD CD CD {539} normal block at 0x004E03C0, 32 bytes long. Data: < L > 07 CD CD CD 00 00 00 00 00 00 4C 00 CD CD CD CD {533} normal block at 0x004E0370, 32 bytes long. Data: < N > 07 CD CD CD 00 00 00 00 00 00 4E 00 CD CD CD CD {527} normal block at 0x004E0320, 32 bytes long. Data: < O > 07 CD CD CD 00 00 00 00 00 00 4F 00 CD CD CD CD {521} normal block at 0x004E02D0, 32 bytes long. Data: < P > 07 CD CD CD 00 00 00 00 00 00 50 00 CD CD CD CD {448} normal block at 0x004EB428, 216 bytes long. Data: <H ~c KN > 48 0B 7E 63 90 4B 4E 00 FF FF FF FF 00 00 00 00 {267} normal block at 0x004EC058, 48 bytes long. Data: <z T r a c e 2 > 7A 00 54 00 72 00 61 00 63 00 65 00 20 00 32 00 {264} normal block at 0x004D6620, 8 bytes long. Data: < > B4 FC F0 01 00 00 00 00 {130} normal block at 0x004D6498, 8 bytes long. Data: < ~c > 88 D0 7E 63 00 00 00 00 {129} normal block at 0x004D6460, 8 bytes long. Data: <t ~c > 74 D0 7E 63 00 00 00 00 {128} normal block at 0x004D6428, 12 bytes long. Data: <(dM (dM > 28 64 4D 00 28 64 4D 00 CD CD CD CD {127} normal block at 0x004D63F0, 8 bytes long. Data: <\ ~c > 5C D0 7E 63 00 00 00 00 Object dump complete. WARNING: Visual Leak Detector detected memory leaks! ---------- Block 144 at 0x004E95A8: 12 bytes ---------- Leak Hash: 0x066C1818, Count: 1, Total 12 bytes Call Stack (TID 4792): Exception thrown at 0x62727EAC (dbghelp.dll) in GyroDRAccTest.exe: 0xC0000005: Access violation reading location 0x03038B28.

Created Unassigned: GDI+ object leaks went undetected [10627]

$
0
0
VLD is awesome. Still I can't it to report leaks from GDI+ objects. For example, simply doing this:

```
Gdiplus::GraphicsPath* p = new GraphicsPath;
```

This won't cause any report, altough it's a major GDI+ object leak. As it seems, GDI+ uses an internal function GdipAlloc (overriding *new*) and HeapAlloc. Maybe it's own override of the new operator it's the problem.

Thanks and keep up the good work.



New Post: Can VLD be used in release builds?

$
0
0
I know _CrtSetAllocHook doesn't exist in release builds and all debugging code for CRT memory isn't there, but I do need to make it work in release. What kind of options to I have? I'm using release crt dll, can I perhaps hook malloc/free function in dll? What options do I have?

New Post: Support of VS2017?

$
0
0
The old version actually still works for me with VS2017, but it didn't display function-names in the callstack and just showed some pointers. So I updated the dbghelp.dll in the Visual Leak Detector install dir and it worked again.

Move them from:
%programfiles(x86)%\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow\Extensions\CppUnitFramework
32bit > \dbghelp.dll
64bit > \x64\dbghelp.dll

and put them:
%programfiles(x86)%\Visual Leak Detector\bin
32bit > \Win32\dbghelp.dll
64bit > \Win64\dbghelp.dll

I didn't test it very througly, yet but I hope it works correctly ^^

New Post: Support of VS2017?

$
0
0
Posseidon, thanks for providing a solution.
I hope that official compatibility with VS2017 will be released soon.

New Post: Google Test memory leaking

$
0
0
Did anyone try to figure out Google Test (GTest) memory leak on debug build????
I did a simple Gtest

No memory leaks detected.
Visual Leak Detector is now exiting.
Detected memory leaks!
Dumping objects ->
{3246} normal block at 0x0024DB20, 8 bytes long.
Data: < $ > E8 DA 24 00 00 00 00 00
{3245} normal block at 0x0023CF68, 32 bytes long.
Data: <h # h # h # > 68 CF 23 00 68 CF 23 00 68 CF 23 00 01 01 CD CD
{3244} normal block at 0x0024DAE8, 12 bytes long.
Data: < $ h # > 20 DB 24 00 68 CF 23 00 00 00 00 00
{3243} normal block at 0x00247E78, 24 bytes long.
Data: < $ > A8 03 24 00 FF FF FF FF 00 00 00 00 00 00 00 00
Object dump complete.
The program '[0x69C] IGyroGUnitTest.exe' has exited with code 0 (0x0).

How VLD can help me to figure out where or pin point the line need to free ???

Thanks

New Post: VLD does not work when the DLL project is present in the solution

$
0
0
Hi,
I have a project which uses multiple DLLs.
When I ran it under MSVC it reports memory leaks, So I downloaded latest VLD.

I added the line "#include <vld.h>" to every project (all DLLs and the executable binaries), copy 2 dlls dupplied with VLD and its pdb over to the directory where binary is, added the lib files to the linker folder of MSVC and ran the program.

I'm using MSVC 2010 on Windows 8.1.

The log of the execution I got can be found here: https://bpaste.net/show/8d06c6a7ab8d.

Turns out that VLD does not work at all when the project is using DLL.

If I run the program and just close it (no DLL will be .loaded) everything works.

I can give the link to the gihub where I have the sources to help investigate why VLD didn't produce anything in that case

Thank you.


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>