2

我正在调试一个 MFC 程序,并且已经到了试图查找和解决内存泄漏的地步。首先,我尝试了 VC 中的内置泄漏检测器,但是一旦我重新定义了 new 运算符,我就遇到了很多关于重新定义“new”和错误的问题。

转到视觉泄漏检测器。我已经启动并运行它,它似乎找到了泄漏,但它似乎找不到文件和行号。这是它的样子:

WARNING: Visual Leak Detector detected memory leaks!
---------- Block 2 at 0x0343F718: 67 bytes ----------
Call Stack:
0x00B88E2F (File and line number not available): program.exe!for__get_vm + 0x1F bytes
0x00B8FC28 (File and line number not available): program.exe!for_rtl_init_wrap_ + 0x118 bytes
f:\dd\vctools\crt_bld\self_x86\crt\src\crt0dat.c (873): MSVCR100D.dll!_initterm
f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c (473): program.exe!__tmainCRTStartup + 0xF bytes
f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c (371): program.exe!wWinMainCRTStartup
0x7540338A (File and line number not available): kernel32.dll!BaseThreadInitThunk + 0x12 bytes
0x77819F72 (File and line number not available): ntdll.dll!RtlInitializeExceptionChain + 0x63 bytes
0x77819F45 (File and line number not available): ntdll.dll!RtlInitializeExceptionChain + 0x36 bytes

Data:
43 3A 5C 50    72 6F 6A 65    63 74 5C 50    72 6F 70 63     ........ ........
61 6C 63 5C    53 65 6B 6F    6E 64 65 6E    54 72 75 6E     ........ ........
6B 5C 77 42    6C 61 64 65    45 64 5C 2E    5C 44 65 62     .Random. .Symbols
75 67 5C 77    42 6C 61 64    65 45 64 2E    65 78 65 00     ........ ........
CD CD CD                                                     ........ ........

在查看了 Visual Leak Detector (VLD) 网站上的常见问题解答后,有一节说明如果发生此错误,则可能是 VLD 无法找到位于 programname.pdb 中的调试符号,因为它必须位于程序名.exe 文件。我已检查(并重建),确保我的项目已打开“生成调试符号”选项,并且已创建 programname.exe 文件并将其放在调试文件夹中的 programname.exe 文件旁边。

不过,我拒绝向我展示文件和行号。此外,在 Visual Studio 的“输出窗口”的最顶部,我可以看到以下行:

'Program.exe': Loaded 'C:\Project\Program\Debug\Program.exe', Symbols loaded.

那么,符号被加载了吗?有任何想法吗?

谢谢!

4

0 回答 0