Chinaunix首页 | 论坛 | 博客
  • 博客访问: 133173
  • 博文数量: 11
  • 博客积分: 171
  • 博客等级: 入伍新兵
  • 技术积分: 387
  • 用 户 组: 普通用户
  • 注册时间: 2012-01-18 20:43
文章分类

全部博文(11)

文章存档

2013年(3)

2012年(8)

我的朋友

分类: LINUX

2012-02-02 13:20:20

  Valgrind是一款用于内存调试、内存泄漏检测以及性能分析的软件开发工具。
  到下载最新版本的valgrind软件。
  安装:
  1. tar -jxvf valgrind-3.7.0.tar.bz2
  2. cd valgrind-3.7.0
  3. ./configure --prefix=/usr/local/valgrind/
  4. make && make install

  检测/bin/下面的ls程序:
  1. [root@localhost ~]# /usr/local/valgrind/bin/valgrind --tool=memcheck --leak-check=full /bin/ls
  2. ==28160== Memcheck, a memory error detector
  3. ==28160== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
  4. ==28160== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
  5. ==28160== Command: /bin/ls
  6. ==28160==
  7. 1check.sh char dbbackup.log foo.c lnmp SA_DATAQUERY_INTERFACES.sh SA_FindDuplicatedPets.prj.sh.log sh valgrind-3.7.0
  8. a.log char.tar.gz dbbackup.sh install.log mbox SA_FindDuplicatedItems.prj.sh sa_hefu.log test.sh valgrind-3.7.0.tar.bz2
  9. a.log~ checktime.sh Desktop install.log.syslog mvbak SA_FindDuplicatedItems.prj.sh.log sa_hefu.sh time2.log wanglei.sql
  10. anaconda-ks.cfg chmv duplicatItem.log iptables-20110211 nagios SA_FindDuplicatedPets.prj.sh SA_Settings.sh time.log zhu
  11. ==28160==
  12. ==28160== HEAP SUMMARY:
  13. ==28160== in use at exit: 22,709 bytes in 41 blocks
  14. ==28160== total heap usage: 93 allocs, 52 frees, 43,497 bytes allocated
  15. ==28160==
  16. ==28160== LEAK SUMMARY:
  17. ==28160== definitely lost: 0 bytes in 0 blocks
  18. ==28160== indirectly lost: 0 bytes in 0 blocks
  19. ==28160== possibly lost: 0 bytes in 0 blocks
  20. ==28160== still reachable: 22,709 bytes in 41 blocks
  21. ==28160== suppressed: 0 bytes in 0 blocks
  22. ==28160== Reachable blocks (those to which a pointer was found) are not shown.
  23. ==28160== To see them, rerun with: --leak-check=full --show-reachable=yes
  24. ==28160==
  25. ==28160== For counts of detected and suppressed errors, rerun with: -v
  26. ==28160== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 19 from 8)
  如上,代表程序ls没有内存错误。
  

阅读(1754) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~