• 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这个命令是没有任何内存问题的。。。

  • 相关阅读:
    phpqrcode生成带logo的二维码图片及带文字的二维码图片
    php 文件压缩zip扩展
    js常用的正则表达操作
    WebViewJavascriptBridge详细使用(转载)
    html5的FormData对象和input的file属性以及window.URL.createObjectURL( ) 方法(转载)
    js面向对象的实现(example 二)
    PHP二维数组(或任意维数组)转换成一维数组的方法汇总
    Yii2实现自定义独立验证器的方法
    yii2.0配置以pathinfo的形式访问
    安装 AdminLTE和 yii2-admin
  • 原文地址:https://www.cnblogs.com/wiessharling/p/3829149.html
Copyright © 2020-2023  润新知