Valgrind内存读写越界检测工具使用说明
2013-10-22 13:54
573 查看
valgrind这款工具是运行在linux下的,可以用来定位c/c++程序中内存使用方面的错误。包括:内存泄漏、使用未初始化的内存、读/写已释放的内存、读/写内存越界、使用malloc/new/new[]和free/delete/delete[]不匹配,等等。
valgrind官方网站:http://valgrind.org/,是一款open source软件。我下载的时候最新版是3.2.3。安装过程很简单——configure,make,make install,安装后不需要任何设置,直接可以开始使用。
valgrind运行方法很简单:valgrind --leak-check=full --track-fds=yes 程序 参数
这样你的程序就会在valgrind监控下运行了,结果会直接输出到屏幕上。如果想把结果输出到日志文件(通常也需要这样),用如下的命令:valgrind --log-file=valgrind_log --leak-check=full --track-fds=yes 程序 参数
运行 :valgrind --leak-check=full --track-fds=yes test -a 后可以得到如下结果。
Address 0x13cd0c34 is 0 bytes after a block of size 28 alloc'd
检查时发现上面打印出的语句,说明内存分配后全部空间都被占用,这是请注意字符串拷贝可能越界。
Valgrind is an instrumentation framework for building dynamic analysis tools. Thereare Valgrind tools that can automatically detect many memory managementand threading bugs, and profile your programs in detail. You can alsouse Valgrind to build new tools.
The Valgrind distribution currently includes six production-qualitytools: a memory error detector, two thread error detectors, a cacheand branch-prediction profiler, a call-graph generating cache andbranch-prediction profiler, and a heap profiler. It also
includesthree experimental tools: a heap/stack/global array overrun detector,a second heap profiler that examines how heap blocks are used, and aSimPoint basic block vector generator. It runs on the followingplatforms: X86/Linux, AMD64/Linux, ARM/Linux, PPC32/Linux,PPC64/Linux,
S390X/Linux, MIPS/Linux, ARM/Android (2.3.x and later),X86/Android (4.0 and later), X86/Darwin and AMD64/Darwin (Mac OS X10.6 and 10.7, with limited support for 10.8).
Valgrind is
Open Source /Free Software,and is freely available under theGNU General Public License,
version 2.
valgrind官方网站:http://valgrind.org/,是一款open source软件。我下载的时候最新版是3.2.3。安装过程很简单——configure,make,make install,安装后不需要任何设置,直接可以开始使用。
valgrind运行方法很简单:valgrind --leak-check=full --track-fds=yes 程序 参数
这样你的程序就会在valgrind监控下运行了,结果会直接输出到屏幕上。如果想把结果输出到日志文件(通常也需要这样),用如下的命令:valgrind --log-file=valgrind_log --leak-check=full --track-fds=yes 程序 参数
运行 :valgrind --leak-check=full --track-fds=yes test -a 后可以得到如下结果。
Address 0x13cd0c34 is 0 bytes after a block of size 28 alloc'd
检查时发现上面打印出的语句,说明内存分配后全部空间都被占用,这是请注意字符串拷贝可能越界。
Valgrind is an instrumentation framework for building dynamic analysis tools. Thereare Valgrind tools that can automatically detect many memory managementand threading bugs, and profile your programs in detail. You can alsouse Valgrind to build new tools.
The Valgrind distribution currently includes six production-qualitytools: a memory error detector, two thread error detectors, a cacheand branch-prediction profiler, a call-graph generating cache andbranch-prediction profiler, and a heap profiler. It also
includesthree experimental tools: a heap/stack/global array overrun detector,a second heap profiler that examines how heap blocks are used, and aSimPoint basic block vector generator. It runs on the followingplatforms: X86/Linux, AMD64/Linux, ARM/Linux, PPC32/Linux,PPC64/Linux,
S390X/Linux, MIPS/Linux, ARM/Android (2.3.x and later),X86/Android (4.0 and later), X86/Darwin and AMD64/Darwin (Mac OS X10.6 and 10.7, with limited support for 10.8).
Valgrind is
Open Source /Free Software,and is freely available under theGNU General Public License,
version 2.
相关文章推荐
- Valgrind内存读写越界检测工具使用说明
- Ubuntu下内存泄露检测工具Valgrind的使用
- android内存泄露检测工具--LeakCanary 中文使用说明
- Linux下使用valgrind工具对C++编程检测内存泄露
- linux开发之Valgrind代码使用内存检测的使用说明
- linux 内存泄露,数组越界检测工具valgrind
- linux 下内存泄露检测工具valgrind的使用
- 在Android环境中使用Valgrind工具进行内存错误检测
- Valgrind内存泄露检测工具使用初步
- 使用Visual Leak Detector for Visual C++ 捕捉内存泄露---Visual C++内存泄露检测—VLD工具使用说明
- valgrind工具的使用,检测内存泄露
- Linux 内存检测工具valgrind使用手册(转)
- 内存泄漏检测工具LeakCanary的使用说明
- Ubuntu下内存泄露检测工具Valgrind的使用
- C/C++检测内存泄漏的工具 vld Visual Leak Detector223 的使用方法和sample示例
- Valgrind 检测程序内存使用
- valgrind: 一款用于内存调试、内存泄漏检测以及性能分析的软件开发工具
- 如何使用Valgrind memcheck工具进行C/C++的内存泄漏检测
- Visual C++内存泄露检测—VLD工具使用说明d
- C/C++检测内存泄漏的工具 vld Visual Leak Detector223 的使用方法和sample示例