一、Valgrind的安装

a、直接使用sudo apt-get install valgrind

b、valgrind官网下载http://valgrind.org/

#解压

sudo tar xvf valgrind-3.8.1.tar.bz2 -C /home/worspace/

#安装

./configure

make

sudo make install

运行:

$valgrind ls -l

出现以下问题:

==18092== Memcheck, a memory error detector

==18092== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.

==18092== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info

==18092== Command: ls -l

==18092==

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: index

valgrind: in an object with soname matching: ld-linux.so.2

valgrind: was not found whilst processing

valgrind: symbols from the object with soname: ld-linux.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.

二、解决办法

仔细阅读上边的log信息,

Possible fixes: (1, short term): install glibc's debuginfo

On Debian, Ubuntu:                 libc6-dbg

ok,执行命令sudo apt-get install libc6-dbg

安装完成后,问题解决

三、使用方法(valgrind --help)

valgrind --leak-check=yes --show-reachable=yes ls -l

以下是截取的结果分析:

==11283== LEAK SUMMARY:

==11283== definitely lost: 80 bytes in 2 blocks

==11283== indirectly lost: 240 bytes in 20 blocks

==11283== possibly lost: 0 bytes in 0 blocks

==11283== still reachable: 13,405 bytes in 23 blocks

==11283== suppressed: 0 bytes in 0 blocks 运行自己的app:

valgrind --leak-check=full --track-origins=yes --show-reachable=yes ./packapp 0 0 HW9_Multimedia_256MDDR_128MFlash_CTT2_mnt.ini

结果分析:

==11295== HEAP SUMMARY:

==11295== in use at exit: 0 bytes in 0 blocks

==11295== total heap usage: 29 allocs, 29 frees, 70,080,768 bytes allocated 可以看到堆栈heap分配了29次,释放了29次。没有reachable的block

四、遗留的问题

上述关于ld-linux.so.2,non stripped ld.so,应该是关于编译链接的问题,需要好好看看《编译原理》了。

Linux valgrind java_Ubuntu下使用valgrind所遇问题相关推荐

  1. Linux valgrind java_linux下利用valgrind工具进行内存泄露检测和性能分析

    valgrind通常用来成分析程序性能及程序中的内存泄露错误 一 Valgrind工具集简绍 Valgrind包含下列工具: 1.memcheck:检查程序中的内存问题,如泄漏.越界.非法指针等. 2 ...

  2. 防止内存泄露 Linux下用Valgrind做检查

    Valgrind技术参考 http://valgrind.org/docs/manual/tech-docs.html 防止内存泄露 Linux下用Valgrind做检查 发布时间:2007.10.2 ...

  3. CLion 下使用 Valgrind 内存检查 [Mac;Linux;Window多平台]

    文章目录 安装 Valgrind 配置 CLion 运行 参考资料 安装 Valgrind Macos: brew tap LouisBrunner/valgrind brew install --H ...

  4. 防止内存泄露 Linux下用Valgrind做检查【ZT】

    用C/C++开发其中最令人头疼的一个问题就是内存管理,有时候为了查找一个内存泄漏或者一个内存访问越界,需要要花上好几天时间,如果有一款工具能够帮助我们做这件事情就好了,valgrind正好就是这样的一 ...

  5. arm linux下交叉编译valgrind工具进行内存泄露检测和性能分析

    C/C++等底层语言在提供强大功能及性能的同时,其灵活的内存访问也带来了各种纠结的问题.如果crash的地方正是内存使用错误的地方,说明你人品好.如果crash的地方内存明显不是consistent的 ...

  6. linux平台软件动态分析工具valgrind系列工具及其可视化

    linux平台软件动态分析工具valgrind系列工具 Memcheck–内存检查工具 Callgrind–函数调用分析工具 Cachegrind–缓存命中分析工具 Helgrind–线程分析工具 M ...

  7. Windows和Linux内存检测工具:Valgrind,Visual Leak Detector,CppCheck, Cpplint

    1 Linux内存泄漏检测工具Valgrind Valgrind简介 Valgrind是一套Linux下,开放源代码(GPL V2)的仿真调试工具的集合.Valgrind由内核(core)以及基于内核 ...

  8. Linux 内存泄漏检测工具 Valgrind

    Valgrind 是一款 Linux下(支持 x86.x86_64和ppc32)程序的内存调试工具,它可以对编译后的二进制程序进行内存使用监测(C语言中的malloc和free,以及C++中的new和 ...

  9. linux目录下所有文件内容替换,linux替换目录下所有文件中的某字符串

    比如,要将目录/modules下面所有文件中的zhangsan都修改成lisi,这样做: sed -i "s/zhangsan/lisi/g" `grep zhangsan -rl ...

最新文章

  1. python processpoolexector 释放内存_关于python:如何在multiprocessing.queue中从Process中释放内存?...
  2. 如何用java+tomcat来创建网站服务器
  3. 三个数从小到大排序—南阳acm
  4. ABAP的include关键字,Java的import, C的include和C4C ABSL 的import比较
  5. 教你用 Newprep 一键封装工具 封装XP克隆系统- 视频教程
  6. ap测试系统软件,符合AUTOSAR(APCP)的嵌入式系统和软件设计工具
  7. 打包(归档)和压缩(包含两者的区别)
  8. 资深程序员的书单 - 转载自@Axb
  9. django实现下载功能
  10. 网站性能并发测试工具
  11. 计算机截图工具无法运行,win7系统打开截图工具提示“截图工具当前未在计算机上运行”的解决方法...
  12. linux 命令两个冒号,为什么两个冒号的错误消息作为bash中的命令(::)有三个冒号,但是一个冒号没有输出?...
  13. 饥荒控制台输入没用_饥荒代码为什么我输入没反应
  14. C#读写内存也不差!(发布C#编写的植物大战僵尸作弊器源码)
  15. excel-柱状图不同柱子不同颜色设置
  16. 百度静态网站全站搜索功能
  17. java的框架_java 三大框架——spring
  18. java对象数组练习,定义数组存储三台汽车对象。汽车的属性有:品牌,价格,颜色。创建三个汽车对象,数据通过键盘输入而来,并把数据存入数组中,打印出每台汽车的信息。
  19. 精通spring4.x 非扫描_巫师财经退出b站的争议,怎样评论才能显得比较精通合同法...
  20. 吃饭理论,抓沙理论,杯子理论——结构化学习,实现N+1,时间管理

热门文章

  1. 130号:SpringBoot使用AOP
  2. Codeforces 869C The Intriguing Obsession
  3. 使用nose_parameterized使unitTest实现参数化
  4. django基础知识之验证码:
  5. shiro框架的使用
  6. 用来向登录页面输出验证码图片的一般处理程序页面
  7. Spring.NET教程(三)——对象的创建(基础篇)
  8. Django视图系统
  9. OpenStack安装流程(juno版)- 添加镜像服务(glance)
  10. (二)Python 装饰器