开发者

How to profile and capture double deletion of and memory corruption in c++

开发者 https://www.devze.com 2022-12-30 06:26 出处:网络
I have application that I compiled with VS 2008 on windows 7 with c++ And I got exception I trying to catch this I created pdb file (because I compiled in release) . and see part of the stack ,but it

I have application that I compiled with VS 2008 on windows 7 with c++ And I got exception I trying to catch this I created pdb file (because I compiled in release) . and see part of the stack ,but it doesn't give me hints on where the error. Im looking for free 开发者_Go百科ways to get this error .can you recommend on free ways to do this?


Visual C++ has pretty good C runtime memory debugging tools built in.

See #define _CRTDBG_MAP_ALLOC, or read: The CRT Debug Heap and Memory Leak Detection Enabling.

It can detect:

  • Memory leaks
  • Double deletes
  • Writing just past the ends of allocated memory

If you have a reproducible case, where the problem allocation always happens at the same time, you can use set it to break into the debugger on that allocation.

There are also commercial tools such as BoundsChecker, HeapAgent, and Purify, and free tools like Fortify, and of course you can roll your own, but you can get a long way with the built-in VisualStudio one.

0

精彩评论

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

关注公众号