我在使用visual studio 2010的Win32项目中包含了vld.h,vld.lib和vld_x86.dll.它构建正确,但是当我执行时,它会崩溃并显示以下消息:
"The application was unable to start correctly (0xc0150002). Click OK to close the application."
Run Code Online (Sandbox Code Playgroud)
我使用Dependency Walker运行它,但它显示并排错误如下:
Error: The Side-by-Side configuration information for "D:\project\..\debug\VLD_X86.DLL" contains errors. The application has failed to start because its side-by-side configuration is incorrect.)
Run Code Online (Sandbox Code Playgroud)
我尝试了各种方法,包括修改清单,如下所示:
https://vld.codeplex.com/discussions/360243
Run Code Online (Sandbox Code Playgroud)
如果我在vld.h上注释了以下行,它只能正常运行
// Force a symbolic reference to the global VisualLeakDetector class object from
// the DLL. This ensures that the DLL is loaded and linked with the program,
// even if no code otherwise imports any of the …Run Code Online (Sandbox Code Playgroud) 我使用Visual Studio 2013有点新,我试图使Visual Leak Detector(版本2.3)工作,以便我可以检查我的项目是否有内存泄漏.
我安装了它并添加了C:\ Program Files(x86)\ Visual Leak Detector\include到我的include目录
和C:\ Program Files(x86)\ Visual Leak Detector\lib\Win32到我的库目录(两者都用于调试模式).
我使用调试菜单(或点击f5)构建并运行以下简单程序:
#include <iostream>
#include <vld.h> //visual leak detector
using namespace std;
int main()
{
for (int i = 0; i < 1000000; i++)
int *ptr = new int(100);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
泄漏在这里显而易见(并且是有意的),以测试功能,但这是我回来的报告:
Visual Leak Detector Version 2.3 installed.
The thread 0x38ac has exited with code 0 (0x0).
No memory leaks detected.
Visual Leak Detector is now exiting.
The program '[8136] Test.exe' has exited …Run Code Online (Sandbox Code Playgroud) 有什么建议?这篇SO帖子讨论了Visual Leak Detector,但我正在寻找其他工具.另外,请不要推荐这个.
c++ memory-leaks visual-c++ memory-leak-detector visual-leak-detector
当我包括:
#include <vld.h>;
Run Code Online (Sandbox Code Playgroud)
在我的stdafx.h中并运行我的程序,它说安装了Visual Leak Detector 2.5.我可以正常运行我的程序但是当它退出时我得到这个错误:
Exception thrown at 0x00007FFFB7F57FE7 (ntdll.dll) in CPPAssessment.exe: 0xC0000005: Access violation reading location 0x00007FFFB8095252.
If there is a handler for this exception, the program may be safely continued.
Run Code Online (Sandbox Code Playgroud)
但是,当我启用Visual Leak Detector时,我才会得到这个,所以我的猜测就是问题所在.
我找到了这个网站:Visual Leak Detector论坛有人提到了一个修复,但它导致了一个带有vld.cpp文件的github repo,我不知道该怎么做.
似乎错误是由Windows 10周年更新引起的,但我不确定.
我尝试使用带有Visual Studio 2017的Visual Leak Detector和平台工具集"Visual Studio 2017"我已经设置了include目录和库目录.正在生成调试信息.加载了exe的符号.
(如果我将平台工具集更改为"Visual Studio 2013",它可以工作)
使用Toolset"Visual Studio 2017"VLD检测泄漏但不解决行号:
Visual Leak Detector read settings from: C:\Program Files (x86)\Visual Leak Detector\vld.ini
Visual Leak Detector Version 2.5.1 installed.
WARNING: Visual Leak Detector detected memory leaks!
---------- Block 1 at 0x005ECDB8: 400 bytes ----------
Leak Hash: 0x36672640, Count: 1, Total 400 bytes
Call Stack (TID 6284):
ucrtbased.dll!malloc()
ConsoleApplication6.exe!0x00361FAD()
ConsoleApplication6.exe!0x003618BC()
ConsoleApplication6.exe!0x00361828()
ConsoleApplication6.exe!0x00361883()
ConsoleApplication6.exe!0x00361F7E()
ConsoleApplication6.exe!0x00361DE0()
ConsoleApplication6.exe!0x00361C7D()
ConsoleApplication6.exe!0x00361F98()
kernel32.dll!BaseThreadInitThunk() + 0x12 bytes
ntdll.dll!RtlInitializeExceptionChain() + 0x63 bytes
ntdll.dll!RtlInitializeExceptionChain() + 0x36 bytes
Run Code Online (Sandbox Code Playgroud)
也许有人知道一种启用行号解析的方法.
谢谢
memory-leak-detector visual-leak-detector visual-studio-2017
我想在Windows中检测我的C++程序的内存泄漏.我也在MSDN上阅读有关mermoy泄漏检测的文档,我也开始使用Visual Leak Detector.
我对泄漏的报告有疑问.我期待一个带行号的文件名,但我总是报告下面的文字.它包含泄漏描述的所有组件(块类型,内存地址,数据等),但文件名和行号除外.
如果是真正的泄漏?如果是,您知道为什么不报告文件/行吗?与此同时,我也在看这个网址
谢谢
Detected memory leaks!
Dumping objects ->
{4723} normal block at 0x04AFB5B8, 8 bytes long.
Data: 2C 3F 00 00 28 3F 00 00
{1476} normal block at 0x04AC3B58, 12 bytes long.
Data: 00 CD CD CD EB 01 75 4C CA 3D 0B 00
Object dump complete.
在我的应用程序中,我收到此错误:
HEAP[App.exe]: HEAP: Free Heap block 61af0f0 modified at 61af194 after it was freed
Run Code Online (Sandbox Code Playgroud)
这是一个调用堆栈:
ntdll.dll!_RtlpBreakPointHeap@4() Unknown
ntdll.dll!@RtlpAllocateHeap@24() Unknown
ntdll.dll!_RtlAllocateHeap@12() Unknown
ntdll.dll!_RtlDebugAllocateHeap@12() Unknown
ntdll.dll!@RtlpAllocateHeap@24() Unknown
ntdll.dll!_RtlAllocateHeap@12() Unknown
> msvcr110d.dll!_heap_alloc_base(unsigned int size) Line 57 C
msvcr110d.dll!_heap_alloc_dbg_impl(unsigned int nSize, int nBlockUse, const char * szFileName, int nLine, int * errno_tmp) Line 431 C++
msvcr110d.dll!_nh_malloc_dbg_impl(unsigned int nSize, int nhFlag, int nBlockUse, const char * szFileName, int nLine, int * errno_tmp) Line 239 C++
msvcr110d.dll!_nh_malloc_dbg(unsigned int nSize, int nhFlag, int nBlockUse, const char * …Run Code Online (Sandbox Code Playgroud) c++ memory memory-leaks heap-corruption visual-leak-detector
这是我的计划
#include <vld.h>
using namespace std;
int main() {
int* p = new int(100);
}
Run Code Online (Sandbox Code Playgroud)
视觉泄漏探测器报告
Visual Leak Detector Version 2.3 installed.
WARNING: Visual Leak Detector detected memory leaks!
---------- Block 1 at 0x00891B60: 4 bytes ----------
Call Stack:
c:\xxx\documents\visual studio 2010\projects\stl1\stl1\stl1.cpp (11): stl1.exe!main + 0x7 bytes
f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c (555): stl1.exe!__tmainCRTStartup + 0x19 bytes
f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c (371): stl1.exe!mainCRTStartup
0x76B7338A (File and line number not available): kernel32.dll!BaseThreadInitThunk + 0x12 bytes
0x774B97F2 (File and line number not available): ntdll.dll!RtlInitializeExceptionChain + 0x63 bytes
0x774B97C5 (File …Run Code Online (Sandbox Code Playgroud) 我正在开发一个包含多个C++ COM Dll的遗留项目.每次在调试配置上构建解决方案时,构建过程都会为每个COM项目提供错误:
Error 10 error MSB3073: The command "
regsvr32 /s /c "D:\*****removed intentionally****_d.dll"
echo regsvr32 exec. time > ".\Debug\regsvr32.trg"
echo Server registration done!
:VCEnd
" exited with code -1073741819.
Run Code Online (Sandbox Code Playgroud)
我最近加入了这个项目,所以当我询问它时,我被告知每个人都会忽略这些错误,因为解决方案在第二个版本上成功构建.
我决定深入挖掘,似乎COM注册本身成功(这解释了为什么第二个版本没有重新尝试注册),但是对regsvr32的调用会返回错误代码(0xC0000005).这就是构建失败的原因.
我还试图从自定义构建步骤中删除注册,而是选择从链接器属性表"注册输出=是"注册,并得到相同的错误.
我尝试用其中一个dll调试regsvr32并找到以下内容:
我最初无法在DllRegisterServer中放置断点,然后我尝试调试regsvr32的X86版本(来自Windows\SysWOW64),然后才能在DllRegisterServer上中断.有人可以解释一下吗?
DllRegisterServer成功并返回S_OK.
DllRegisterServer返回后,抛出异常,并出现以下异常和堆栈跟踪:
regsvr32.exe中0x759849c1处的第一次机会异常:0xC0000005:访问冲突读取位置0x005bf028.
oleaut32.dll!_MemFree@4() + 0x25 bytes
oleaut32.dll!OLE_TYPEMGR::Release() + 0x1b138 bytes
oleaut32.dll!ReleaseAppData() + 0x317 bytes
oleaut32.dll!_OACleanup@0() + 0x5 bytes
ole32.dll!wCoUninitialize(COleTls & Tls, int fHostThread) Line 2830 C++
ole32.dll!CoUninitialize() Line 2620 C++
regsvr32.exe!_wWinMain@16() + 0xa77 bytes
regsvr32.exe!__initterm_e() + 0x1b1 bytes
kernel32.dll!@BaseThreadInitThunk@12() + 0x12 bytes
ntdll.dll!___RtlUserThreadStart@8() …Run Code Online (Sandbox Code Playgroud) 无论我尝试什么,我似乎无法让VLD捕获任何内存泄漏.有什么想法吗?
这里的输出片段也是:
Visual Leak Detector Version 2.4RC2 installed.
The thread 0x5748 has exited with code 0 (0x0).
The thread 0x2c70 has exited with code 0 (0x0).
The thread 0x3c98 has exited with code 0 (0x0).
No memory leaks detected.
Visual Leak Detector is now exiting.
The program '[24988] ConsoleApplication2.exe' has exited with code 0 (0x0).
Run Code Online (Sandbox Code Playgroud)
#include <vld.h>
#include <iostream>
using namespace std;
class Car{
public:
Car() {}
Car(string model,int year, string color) {
this->model = model; this->color, this->year = year; …Run Code Online (Sandbox Code Playgroud)