最近调试一应用程序时,当软件退出时(dll unload),突然就不断出现“A heap allocation was leaked”的中断异常,花了许多精力去排除程序代码中所有潜在的、可能的“作案”代码,一无所获。
尝试百度,发现根本没有这方面的资料,只能人工跑代码了,代码注释得面目全非,仍旧未解决。
其实这中断完全可以跳过(Microsoft Application Verifier中取消Leak检测或者VS中忽略该异常),但是作为编程人员,不知道还好,如果发现了瑕疵而不解决的话心里着实过不去。
无奈,回归提示,在VS的内存窗口中查看输出内容中给出的“Address of the owner dll name”(其实我之前一直只注意Address of the leaked allocation, 个人疏忽),出现了关键一幕,QQPingyin.ime, 尝试禁用那个dll,问题解决。
=======================================
0A37011C : Address of the leaked allocation. Run !heap -p -a <address> to get additional information about the allocation.
04023EE4 : Address to the allocation stack trace. Run dps <address> to view the allocation stack.
4E5B0FE0 : Address of the owner dll name. Run du <address> to read the dll name.
706D0000 : Base of the owner dll. Run .reload <dll_name> = <address> to reload the owner dll. Use 'lm' to get more information about the loaded and unloaded modules.
=======================================
This verifier stop is continuable.
After debugging it use `go' to continue.
=======================================