最近調試一應用程序時,當軟件退出時(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.
=======================================