使用valgrind检测Android(安卓)native程序的内存
16lz
2022-03-04
下载http://valgrind.org/downloads/valgrind-3.7.0.tar.bz2,使用ndk toolchain,按照代码中的README.android编译Android版本的valgrind,push到/data分区,这里笔者push到了/data/local/valgrind/,同时把VALGRIND_LIB 环境变量设置为/data/local/valgrind/lib/valgrind
编写一个有很多内存错误的程序:
使用valgrind运行之:
得到如下结果:
这些错误可以分为如下几类:
- Illegal read / Illegal write errors
- Use of uninitialised values
- Use of uninitialised or unaddressable values in system calls
- Illegal frees
- When a heap block is freed with an inappropriate deallocation function
- Overlapping source and destination blocks
- Memory leak detection
更多相关文章
- Android——扩大ImageButton的点击区域
- Android的线程使用来更新UI----Thread、Handler、Looper、TimerT
- android工程在eclipse中报错解决办法
- android webview 加载进度和自定义404错误页面
- Android(安卓)gallery实现图片的左右循环旋转源码分享
- Android(安卓)之 自动提示功能(AutoCompleteTextView)的使用
- 箭头函数的基础使用
- NPM 和webpack 的基础使用
- Python list sort方法的具体使用