当前位置: 首页 > news >正文

Ubuntu12.04下使用valgrind内存测试工具测试Qt程序

1. 到官网http://valgrind.org/downloads/上下载valgrind最新版本;

2. 解压源码,执行./configure;make;make install后,默认安装到/usr/local/bin下,执行:

valgrind ls -l

3. 提示:

==14336== Memcheck, a memory error detector
==14336== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==14336== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==14336== Command: ls -l
==14336==

valgrind:  Fatal error at startup: a function redirection
valgrind:  which is mandatory for this platform-tool combination
valgrind:  cannot be set up.  Details of the redirection are:
valgrind:
valgrind:  A must-be-redirected function
valgrind:  whose name matches the pattern:      strlen
valgrind:  in an object with soname matching:   ld-linux-x86-64.so.2
valgrind:  was not found whilst processing
valgrind:  symbols from the object with soname: ld-linux-x86-64.so.2
valgrind:
valgrind:  Possible fixes: (1, short term): install glibc's debuginfo
valgrind:  package on this machine.  (2, longer term): ask the packagers
valgrind:  for your Linux distribution to please in future ship a non-
valgrind:  stripped ld.so (or whatever the dynamic linker .so is called)
valgrind:  that exports the above-named function using the standard
valgrind:  calling conventions for this platform.  The package you need
valgrind:  to install for fix (1) is called
valgrind:
valgrind:    On Debian, Ubuntu:                 libc6-dbg
valgrind:    On SuSE, openSuSE, Fedora, RHEL:   glibc-debuginfo
valgrind:
valgrind:  Cannot continue -- exiting now.  Sorry.

大概是说我的glibc是个strip后的版本,需要下载debug版,debug版的名字是libc6-dbg。

    执行:

sudo apt-get install libc6-dbg

4. 再次执行valgrind ls -l,输出:

==14378== Memcheck, a memory error detector
==14378== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==14378== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==14378== Command: ls -l
==14378==
total 108
drwxr-xr-x   2 root root  4096 2012-07-13 03:26 bin
drwxr-xr-x   3 root root  4096 2012-07-13 07:36 boot
drwxr-xr-x   2 root root  4096 2012-07-13 07:06 cdrom
drwxr-xr-x  17 root root  3620 2012-07-24 03:00 dev
drwxr-xr-x 128 root root 12288 2012-07-24 03:06 etc
drwxr-xr-x   3 root root  4096 2012-07-13 08:16 home
lrwxrwxrwx   1 root root    33 2012-07-13 07:07 initrd.img -> boot/initrd.img-2.6.32-38-generic
drwxr-xr-x  16 root root 12288 2012-07-13 03:23 lib
drwxr-xr-x   2 root root  4096 2012-07-13 03:24 lib32
lrwxrwxrwx   1 root root     4 2012-07-13 07:03 lib64 -> /lib
drwx------   2 root root 16384 2012-07-13 07:03 lost+found
drwxr-xr-x   4 root root  4096 2012-07-13 02:13 media
drwxr-xr-x   2 root root  4096 2012-02-03 04:21 mnt
drwxr-xr-x   2 root root  4096 2012-07-13 07:03 opt
dr-xr-xr-x 182 root root     0 2012-07-24 02:58 proc
drwx------   8 root root  4096 2012-07-24 21:25 root
drwxr-xr-x   2 root root  4096 2012-07-16 01:21 sbin
drwxr-xr-x   2 root root  4096 2009-12-05 17:25 selinux
drwxr-xr-x   2 root root  4096 2012-07-13 07:03 srv
drwxr-xr-x  13 root root     0 2012-07-24 02:58 sys
drwxrwxrwx   2 root root  4096 2012-07-16 01:39 tftpboot
drwxrwxrwt  14 root root  4096 2012-07-24 21:31 tmp
drwxr-xr-x  11 root root  4096 2012-07-13 03:23 usr
drwxr-xr-x  15 root root  4096 2012-07-13 07:31 var
lrwxrwxrwx   1 root root    30 2012-07-13 07:07 vmlinuz -> boot/vmlinuz-2.6.32-38-generic
drwxrwxrwx   6 root root  4096 2012-07-24 03:02 work
==14378==
==14378== HEAP SUMMARY:
==14378==     in use at exit: 20,081 bytes in 58 blocks
==14378==   total heap usage: 1,798 allocs, 1,740 frees, 164,568 bytes allocated
==14378==
==14378== LEAK SUMMARY:
==14378==    definitely lost: 240 bytes in 3 blocks
==14378==    indirectly lost: 480 bytes in 20 blocks
==14378==      possibly lost: 0 bytes in 0 blocks
==14378==    still reachable: 19,361 bytes in 35 blocks
==14378==         suppressed: 0 bytes in 0 blocks
==14378== Rerun with --leak-check=full to see details of leaked memory
==14378==
==14378== For counts of detected and suppressed errors, rerun with: -v
==14378== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)

看来ls这个命令是没有任何内存问题的。。。

 

转载于:https://www.cnblogs.com/wiessharling/p/3829149.html

相关文章:

  • 占位符的使用
  • OpenFlow协议标准演进过程
  • 收集与测试相关的所有工具
  • ORACLE优化器RBO与CBO介绍总结
  • 那些踩过的坑
  • 数学图形(1.44)超圆
  • ASP.NET MVC之单元测试分分钟的事
  • 连接池的概念
  • HBase集群安装过程中的问题集锦
  • jQuery星级评论打分组件
  • 如何构建一个优秀的移动网站?谷歌专家教你25招(三)[转]
  • 十四个很准的心理暗示
  • 导入EXCEL记得忽略表头
  • 流媒体播放mime类型添加
  • IPv6_1_1_rfc2460_IPv6 Specification
  • hexo+github搭建个人博客
  • [js高手之路]搞清楚面向对象,必须要理解对象在创建过程中的内存表示
  • angular2开源库收集
  • IndexedDB
  • Javascript Math对象和Date对象常用方法详解
  • JAVA多线程机制解析-volatilesynchronized
  • JDK9: 集成 Jshell 和 Maven 项目.
  • Median of Two Sorted Arrays
  • python 学习笔记 - Queue Pipes,进程间通讯
  • Spring Cloud Alibaba迁移指南(一):一行代码从 Hystrix 迁移到 Sentinel
  • spring学习第二天
  • Travix是如何部署应用程序到Kubernetes上的
  • Vue2.0 实现互斥
  • 简单数学运算程序(不定期更新)
  • 每个JavaScript开发人员应阅读的书【1】 - JavaScript: The Good Parts
  • 盘点那些不知名却常用的 Git 操作
  • 深入浏览器事件循环的本质
  • 一起参Ember.js讨论、问答社区。
  • 在 Chrome DevTools 中调试 JavaScript 入门
  • 怎样选择前端框架
  • 3月27日云栖精选夜读 | 从 “城市大脑”实践,瞭望未来城市源起 ...
  • 如何用纯 CSS 创作一个菱形 loader 动画
  • #鸿蒙生态创新中心#揭幕仪式在深圳湾科技生态园举行
  • (二)基于wpr_simulation 的Ros机器人运动控制,gazebo仿真
  • (二十五)admin-boot项目之集成消息队列Rabbitmq
  • (非本人原创)史记·柴静列传(r4笔记第65天)
  • (附源码)计算机毕业设计SSM疫情社区管理系统
  • (论文阅读23/100)Hierarchical Convolutional Features for Visual Tracking
  • (四)c52学习之旅-流水LED灯
  • (五)Python 垃圾回收机制
  • (一)Java算法:二分查找
  • (原創) 如何安裝Linux版本的Quartus II? (SOC) (Quartus II) (Linux) (RedHat) (VirtualBox)
  • (转)c++ std::pair 与 std::make
  • *2 echo、printf、mkdir命令的应用
  • .NET开发不可不知、不可不用的辅助类(一)
  • .NET与 java通用的3DES加密解密方法
  • .Net转Java自学之路—基础巩固篇十三(集合)
  • @AutoConfigurationPackage的使用
  • @RequestMapping用法详解
  • [AutoSar]状态管理(五)Dcm与BswM、EcuM的复位实现