Pergunta

Is there any tool to help me detect heap corruption in C++? I can't provide source code because it's a big project. I can use any tool that works with Visual Studio or with xcode. The tool should work fine with multithreading. The problem is not very common, it appears after a long time and only in very special cases(they were not detected precisely!).

Thank you!

EDIT:

Thanks you all for your answers! I will test the tools and I will accept one answer after the tests.

Foi útil?

Solução

Valgrind is the defacto tool for doing memory instrumentation for native code. It, however, does not run on Windows (OS X is fine).

There are a few commercial tools which do run on Windows, and while they feature a GUI, are in my opinion inferior to Valgrind.

Outras dicas

The debugging tools for Windows include gflags and page heap which help detecting heap corruptions.

On Mac OS X (which I presume is what you mean when you say Xcode), you have a whole bunch of memory debugging tools already, e.g. http://developer.apple.com/library/mac/#releasenotes/DeveloperTools/RN-MallocOptions/index.html which lets you turn on heap checking via environment variables.

On Windows use Application Verifier

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top