Valgrind 编译及使用
来源:互联网 发布:阿里云搭建vpn云免 编辑:程序博客网 时间:2024/06/05 20:58
Valgrind 是一款 Linux下程序的内存调试工具,它可以对编译后的二进制程序进行内存使用监测(C语言中的malloc和free,以及C++中的new和delete),找出内存泄漏问题。
Valgrind 中包含的 Memcheck 工具可以检查以下的程序错误:
使用未初始化的内存 (Use of uninitialised memory)
使用已经释放了的内存 (Reading/writing memory after it has been free’d)
使用超过malloc分配的内存空间(Reading/writing off the end of malloc’d blocks)
对堆栈的非法访问 (Reading/writing inappropriate areas on the stack)
申请的空间是否有释放 (Memory leaks – where pointers to malloc’d blocks are lost forever)
malloc/free/new/delete申请和释放内存的匹配(Mismatched use of malloc/new/new [] vs free/delete/delete [])
src和dst的重叠(Overlapping src and dst pointers in memcpy() and related functions)
Valgrind 中包含的 Memcheck 工具可以检查以下的程序错误:
使用未初始化的内存 (Use of uninitialised memory)
使用已经释放了的内存 (Reading/writing memory after it has been free’d)
使用超过malloc分配的内存空间(Reading/writing off the end of malloc’d blocks)
对堆栈的非法访问 (Reading/writing inappropriate areas on the stack)
申请的空间是否有释放 (Memory leaks – where pointers to malloc’d blocks are lost forever)
malloc/free/new/delete申请和释放内存的匹配(Mismatched use of malloc/new/new [] vs free/delete/delete [])
src和dst的重叠(Overlapping src and dst pointers in memcpy() and related functions)
重复free
-----------------------------------------1、编译安装 Valgrind:---------------------------------------------
wget http://valgrind.org/downloads/valgrind-3.12.0.tar.bz2
tar xjvf valgrind-3.12.0.tar.bz2
cd valgrind-3.12.0.tar.bz2
./autogen.sh
./configure --prefix=/home/valgrind/valgrind-install/
make
make install
------------------------------------------2、使用示例 "ls /"--------------------------------------------------------
对“ls”程序进行检查,返回结果中的“definitely lost: 0 bytes in 0 blocks.”表示没有内存泄漏。
对“test”程序进行检查
/home/valgrind/valgrind-install/bin/valgrind --tool=memcheck --leak-check=full ./test arg
阅读全文
0 0
- Valgrind 编译及使用
- valgrind实时内存工具的编译及使用
- valgrind的编译和使用
- 使用valgrind时的编译选项
- valgrind安装与使用 交叉编译
- valgrind 的使用及错误信息分析
- Valgrind使用
- valgrind 使用
- Valgrind 使用
- 使用Valgrind
- valgrind 使用
- Valgrind使用
- valgrind 使用
- Valgrind 使用
- valgrind 使用
- valgrind使用
- valgrind使用
- Valgrind使用
- 关于百度地图api的使用心得
- C语言的第七天学习
- mysql 远程访问
- OverlayIcon 制作流程及注意项
- c#中DateTimeKind的
- Valgrind 编译及使用
- 如何建立应付暂估明细查询
- CHAP认证原理解析
- Halcon学习笔记之缺陷检测
- 第二十二讲 HashSet和HashMap、迭代器、TreeMap集合、Collections工具类、JDK8之Optional类
- 卷积神经网络CNN经典模型整理Lenet,Alexnet,Googlenet,VGG,Deep Residual Learning
- 12月7日云栖精选夜读:特鲁多对话马云:请为加拿大小企业多花一些时间!
- hexo-迁移到linux所遇到的问题
- Animation事件,结束,开始