我刚刚在Windows 8上安装了Visual Leak Detector(2.3)。我使用空白的CRT程序(在Visual Studio 2012中)测试它,什么都不做。
#include <vld.h>
int main(int argc, char** argv)
{
return 0;
}
当我运行它时,VLD会在vc ++ crt模块中报告奇怪的泄漏:
Visual Leak Detector Version 2.3 installed.
WARNING: Visual Leak Detector detected memory leaks!
---------- Block 31 at 0x0000000052C07530: 70 bytes ----------
Call Stack:
f:\dd\vctools\crt_bld\self_64_amd64\crt\src\stdenvp.c (127): my_application.exe!_setenvp + 0x27 bytes
f:\dd\vctools\crt_bld\self_64_amd64\crt\src\crt0.c (223): my_application.exe!__tmainCRTStartup + 0x5 bytes
f:\dd\vctools\crt_bld\self_64_amd64\crt\src\crt0.c (164): my_application.exe!mainCRTStartup
0x00000000FAF8167E (File and line number not available): KERNEL32.DLL!BaseThreadInitThunk + 0x1A bytes
0x00000000FD8CC3F1 (File and line number not available): ntdll.dll!RtlUserThreadStart + 0x21 bytes
Data:
20 B5 C0 52 50 00 00 00 50 92 C0 52 50 00 00 00 ...RP... P..RP...
20 91 DD E1 F6 07 00 00 7E 00 00 00 02 00 00 00 ........ ~.......
12 00 00 00 00 00 00 00 1F 00 00 00 FD FD FD FD ........ ........
50 52 4F 43 45 53 53 4F 52 5F 4C 45 56 45 4C 3D PROCESSO R_LEVEL=
36 00 FD FD FD FD 6....... ........
---------- Block 40 at 0x0000000052C075D0: 72 bytes ----------
Call Stack:
f:\dd\vctools\crt_bld\self_64_amd64\crt\src\stdenvp.c (127): my_application.exe!_setenvp + 0x27 bytes
f:\dd\vctools\crt_bld\self_64_amd64\crt\src\crt0.c (223): my_application.exe!__tmainCRTStartup + 0x5 bytes
f:\dd\vctools\crt_bld\self_64_amd64\crt\src\crt0.c (164): my_application.exe!mainCRTStartup
0x00000000FAF8167E (File and line number not available): KERNEL32.DLL!BaseThreadInitThunk + 0x1A bytes
0x00000000FD8CC3F1 (File and line number not available): ntdll.dll!RtlUserThreadStart + 0x21 bytes
Data:
F0 94 C0 52 50 00 00 00 20 76 C0 52 50 00 00 00 ...RP... .v.RP...
20 91 DD E1 F6 07 00 00 7E 00 00 00 02 00 00 00 ........ ~.......
14 00 00 00 00 00 00 00 28 00 00 00 FD FD FD FD ........ (.......
53 45 53 53 49 4F 4E 4E 41 4D 45 3D 43 6F 6E 73 SESSIONN AME=Cons
6F 6C 65 00 FD FD FD FD ole..... ........
---------- Block 41 at 0x0000000052C07620: 67 bytes ----------
Call Stack:
f:\dd\vctools\crt_bld\self_64_amd64\crt\src\stdenvp.c (127): my_application.exe!_setenvp + 0x27 bytes
f:\dd\vctools\crt_bld\self_64_amd64\crt\src\crt0.c (223): my_application.exe!__tmainCRTStartup + 0x5 bytes
f:\dd\vctools\crt_bld\self_64_amd64\crt\src\crt0.c (164): my_application.exe!mainCRTStartup
0x00000000FAF8167E (File and line number not available): KERNEL32.DLL!BaseThreadInitThunk + 0x1A bytes
0x00000000FD8CC3F1 (File and line number not available): ntdll.dll!RtlUserThreadStart + 0x21 bytes
Data:
D0 75 C0 52 50 00 00 00 D0 96 C0 52 50 00 00 00 .u.RP... ...RP...
20 91 DD E1 F6 07 00 00 7E 00 00 00 02 00 00 00 ........ ~.......
0F 00 00 00 00 00 00 00 29 00 00 00 FD FD FD FD ........ ).......
53 79 73 74 65 6D 44 72 69 76 65 3D 43 3A 00 FD SystemDr ive=C:..
FD FD FD ........ ........
---------- Block 43 at 0x0000000052C07670: 65 bytes ----------
Call Stack:
f:\dd\vctools\crt_bld\self_64_amd64\crt\src\stdenvp.c (127): my_application.exe!_setenvp + 0x27 bytes
f:\dd\vctools\crt_bld\self_64_amd64\crt\src\crt0.c (223): my_application.exe!__tmainCRTStartup + 0x5 bytes
f:\dd\vctools\crt_bld\self_64_amd64\crt\src\crt0.c (164): my_application.exe!mainCRTStartup
0x00000000FAF8167E (File and line number not available): KERNEL32.DLL!BaseThreadInitThunk + 0x1A bytes
0x00000000FD8CC3F1 (File and line number not available): ntdll.dll!RtlUserThreadStart + 0x21 bytes
Data:
D0 96 C0 52 50 00 00 00 C0 76 C0 52 50 00 00 00 ...RP... .v.RP...
20 91 DD E1 F6 07 00 00 7E 00 00 00 02 00 00 00 ........ ~.......
0D 00 00 00 00 00 00 00 2B 00 00 00 FD FD FD FD ........ +.......
54 45 4D 50 3D 46 3A 5C 54 45 4D 50 00 FD FD FD TEMP=F:\ TEMP....
FD ........ ........
Visual Leak Detector detected 48 memory leaks (6044 bytes).
Largest number used: 15094 bytes.
Total allocations: 25276 bytes.
Visual Leak Detector is now exiting.
网上没有太多关于此的详细信息,但在this msdn论坛中评论说:
那不是真正的泄密事故。为您的环境做好准备 执行&#39 ;.它正在制作流程环境的可写副本 对于期望它的程序,它们将在发布时发布 进程退出。您可以放心地忽略该报告。
但是,我想禁止这些行显示为报告(如果它们真的没有泄漏)
有没有人经历过这个并知道如何理清?
答案 0 :(得分:1)
最简单的解决方案显然是在vld.ini文件中添加main()
,然后从SELECT daytab7.pid, maxval_7day,maxvaldate_7day,maxval_30day,maxvaldate_30day
FROM
( /*picking top-most ranked value and corresp. date*/
SELECT PID, MY_VALUE MAXVAL_7DAY, VALUE_DATE MAXVALDATE_7DAY
FROM
( /*Assigning rank for range filtered values*/
SELECT PID, MY_VALUE, VALUE_DATE, RANK() OVER(PARTITION BY PID ORDER BY MY_VALUE DESC) RNK
FROM
( /*assigning row_number by ordering rows by value_date desc to get recent data for specified range of 7 days*/
SELECT PID, MY_VALUE, VALUE_DATE,
ROW_NUMBER() OVER(PARTITION BY PID ORDER BY VALUE_DATE DESC) ROW_NUM
FROM MY_TABLE
ORDER BY 1, 3 DESC
)
WHERE ROW_NUM <= 7
)
WHERE RNK = 1
) daytab7,
( /*picking top-most ranked value and corresp. date*/
SELECT PID, MY_VALUE MAXVAL_30DAY, VALUE_DATE MAXVALDATE_30DAY
FROM
( /*Assigning rank for range filtered values*/
SELECT PID, MY_VALUE, VALUE_DATE, RANK() OVER(PARTITION BY PID ORDER BY MY_VALUE DESC) RNK
FROM
( /*assigning row_number by ordering rows by value_date desc to get recent data for specified range of 30 days*/
SELECT PID, MY_VALUE, VALUE_DATE, ROW_NUMBER() OVER(PARTITION BY PID ORDER BY VALUE_DATE DESC) ROW_NUM
FROM MY_TABLE
ORDER BY 1, 3 DESC
)
WHERE ROW_NUM <= 30
)
WHERE RNK = 1
) daytab30
WHERE daytab7.pid = daytab30.pid
的第一行显式启用它。当然,你也会错过&#34;内存泄漏&#34;来自你的全球物品,但这通常同样无害。
答案 1 :(得分:0)
我发现这是VLD 2.3中的错误。错误的详细信息是here。我刚刚下载了v2.4rc2(vld-2.4rc2-setup.exe),这个问题似乎不再出现了。 (我已经下载了v2.3,因为它已被标记为稳定)