开发者

Finding memory violations/leaks

I have an application developed in VC 2008 (C++) which uses axis dlls, which use openssl dlls. And someone in the chain corrupts heap - a situation which ends up giving me "memory access violation" in my application in places where violation shouldn't/couldn't happen. So, someone in the chain axis-ssl corrupts something, but I cannot find who or what.

I tried using DevPartner's tool for memory leaks, but it finds no leaks - no anything.

How should I approach this problem? I looked over axis and ssl documentation a number of times, and implemented and checked all 开发者_开发百科possible memory management issues and fixes, but to no avail.

Thank you very much! Marin


Try using MS application verifier. It integrates with Visual Studio, so you can make "verified" run directly from it.


Why do you think a leak could be somehow responsible for a corruption? You'd need to watch out for out-of-bounds access, dead pointer access, illegal casts and things like that, not for a leak. It's a tricky thing to do. Valgrind is a great tool for chasing this sort of issues, but unfortunately it's not available for Win32. If your code is portable, you could try debugging it on Linux, otherwise you'd either need to use commercial tools like Purify, or do it the good old way, with a help of logging and assertions, and a debugger of course.


If you get the debug versions of the libraries, MSVC offers a debug malloc and free, as well as a debug new and delete. These contain things like overwrite detection.

http://msdn.microsoft.com/en-us/library/bebs9zyz.aspx


May be this MSDN article might have the answers you are looking for: Finding a Memory Leak

Also you could try this LeakDiag tool. Not sure as to why there is no reference to it in MSDN?!?!? But there is a neat article in Codeproject.com

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜