当前位置:网站首页>内存分析与内存泄漏检测
内存分析与内存泄漏检测
2022-06-23 04:21:00 【linchaolong】
Android
查看所有进程内存占用情况
(1)连接设备,打开USE调试模式
(2)打开命令行,执行命令:adb shell procrank

字段说明:
PID:进程id
VSS(Virtual Set Size): 虚拟耗用内存(包含共享库占用的内存)
RSS(Resident Set Size):实际使用物理内存(包含共享库占用的内存)
PSS(Proportional Set Size): 实际使用的物理内存(比例分配共享库占用的内存)USS(Unique Set Size): 进程独自占用的物理内存(不包含共享库占用的内存)
cmdline:进程名称
查看Heap信息
1.打开Eclipse的DDMS窗口,选择需要查看的应用
2.点击Update Heap

3.点击Cause GC按钮,触发Java的内存回收机制,点击后会在Heap窗口显示该进程的堆信息,并定时刷新。

字段说明:
Heap Size:堆内存总大小
Allocated:已使用的堆内存大小
Free:空闲的堆内存大小
Used:已使用堆内存大小百分比
Objects:对象个数
相关文章:Android最佳性能实践(二)——分析内存的使用情况
内存泄漏检测工具(VLD)
工具下载地址
下载地址1:https://vld.codeplex.com/releases
下载地址2:http://pan.baidu.com/s/1gd7vQnD
安装完成后,使用visual studio创建的项目,默认会包含vld的头文件目录。

而且bin目录下的运行库已经自动添加到Path变量中。

我们需要做的只是在源码中#include <vld.h>,一般在项目入口文件中包含。

这里,我手动制造了内存泄漏。在map.cpp的第10行和第12行。
程序支行结束后,检测到动态分配的内存没有delete或free,在输出—调试窗口中会输出其内存泄漏相关的信息。

这里提示在main.cpp第10行发生了内存泄漏,泄漏了8个字节,点击可直接定位到内存泄漏的那行代码。Block后面的数字表面第几处内存泄漏。
边栏推荐
- Operating mongodb in node
- 数字藏品火热背后需要强大的技术团队支持 北方技术团队
- Wechat applet: Puzzle toolbox
- How can digital collections empower economic entities?
- Adnroid activity screenshot save display to album view display picture animation disappear
- 数字藏品到底有什么魔力?目前有哪些靠谱的团队在开发
- [image fusion] sparse regularization based on non convex penalty to realize image fusion with matlab code
- APP SHA1获取程序 百度地图 高德地图获取SHA1值的简单程序
- Basic calculator II for leetcode topic analysis
- PAT 乙等 1012 C语言
猜你喜欢

C primer plus learning notes - 2. Constant and formatted IO (input / output)

Android handler memory leak kotlin memory leak handling

MySQL面试真题(二十四)——行列互换

Kotlin Android simple activity jump, simple combination of handler and thread
![[image fusion] sparse regularization based on non convex penalty to realize image fusion with matlab code](/img/e2/24eb2a60e3dc603b3ec4bfefd0b8e5.png)
[image fusion] sparse regularization based on non convex penalty to realize image fusion with matlab code

数字藏品火热背后需要强大的技术团队支持 北方技术团队

What does the English letter PC mean? What does the Internet PC mean

雷达图canvas

Wechat applet: wechat can also send flash photos to create wechat applet source code download and customize flash time

True MySQL interview question (XXII) -- condition screening and grouping screening after table connection
随机推荐
数字藏品到底有什么魔力?目前有哪些靠谱的团队在开发
Leetcode topic analysis: factorial training zeroes
[image fusion] sparse regularization based on non convex penalty to realize image fusion with matlab code
Kotlin android简单Activity跳转、handler和thread简单配合使用
数字藏品如何赋能经济实体?
The digital collection market has just begun
Explicability of counter attack based on optimal transmission theory
制造业数字化转型存在问题及原因分析
Wireshark TS | 视频 APP 无法播放问题
PAT 乙等 1019 C语言
Alibaba cloud object storage oss+picgo+typera implements the construction map
PAT 乙等 1021 个位数统计
Activity启动模式和生命周期实测结果
C primer plus learning notes - 2. Constant and formatted IO (input / output)
新课上线 | 每次 5 分钟,轻松玩转阿里云容器服务!
PAT 乙等 1016 C语言
技能自检 | 想当测试Leader,这6项技能你会吗?
ORB_SLAM2运行
技术开发团队视角看到的数字藏品机遇与挑战
Genetic engineering of AI art? Use # artbreeder to change any shape of the image