应用层内存溢出/越界/重复释放等问题检查工具
Posted zengjianrong
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了应用层内存溢出/越界/重复释放等问题检查工具相关的知识,希望对你有一定的参考价值。
https://github.com/google/sanitizers/wiki
https://github.com/google/sanitizers/wiki/AddressSanitizer
AddressSanitizer (aka ASan) is a memory error detector for C/C++. It finds:
- Use after free (dangling pointer dereference)
- Heap buffer overflow
- Stack buffer overflow
- Global buffer overflow
- Use after return
- Use after scope
- Initialization order bugs
- Memory leaks
This tool is very fast. The average slowdown of the instrumented program is ~2x (see AddressSanitizerPerformanceNumbers).
The tool consists of a compiler instrumentation module (currently, an LLVM pass) and a run-time library which replaces the malloc
function.
功能强大,使用方便,默认集成到了gcc 4.8;
集成方便,只需使用clang +一些flag,同时还可以做过滤:例如已知函数的泄露
性能还不错,只是源程序×2的占用,相比valgrind要好得多;
可跟gdb/objdump -ldS使用;
以上是关于应用层内存溢出/越界/重复释放等问题检查工具的主要内容,如果未能解决你的问题,请参考以下文章