memory泄露分析方法(Binder,Window,View篇)

View泄露:Hprof 找大量重复的view,点击查看text文案如果相同则找产品他们确认是否合理 **window泄露:**代码或dumpsys window来监测是否有大量同名window,不能用windowtoken来辨别是否重复window,每个window token都不一样,windowtoken初始化过程如下所示:

复制代码
ViewRootImpl(
mWindow = new W(this);
mAttachInfo = new View.AttachInfo(mWindowSession, mWindow, display, this, mHandler, this,context);
mWindowToken = window.asBinder();

Binder泄露:

复制代码
Too many Binders sent to SYSTEM

2类泄漏:

  • ProxyBinders:本地持有对端remote binder对象:(向外发1次binder请求,新建1个Proxy Binders对象) 我有多少联系人

2种报错形式

  • Debuggable builds will throw an AssertionError if the number of map entries exceeds 25_000

    Binder ProxyMap has too many entries: 20691 (total), 20691 (uncleared), 20691 (uncleared after GC ). BinderProxy leak?

  • Android系统创建的Binder数量最大值超过6000,非systemuid的binder调用会被kill掉

2种泄漏原因:

  1. Death Recipients泄露

  2. 对端注册了太多的callback导致泄漏

  • LocalBinders:本地创建的bindercallback对象,传给Server对端回调我用(LocalBinders数量,有多少个人可联系上)

Android BinderProxy leak 原理分析-CSDN博客

相关推荐
神龙天舞200119 分钟前
MySQL 备库为什么会延迟好几个小时
android·数据库·mysql
码农coding4 小时前
android12 systemUI 之锁屏
android
圆山猫4 小时前
[Virtualization](三):RISC-V H-extension 与 Guest 执行模式
android·java·risc-v
爱笑鱼4 小时前
Binder(七):getCallingUid() 读到的是谁?clearCallingIdentity() 又清掉了什么?
android
2501_9159090610 小时前
iOS 应用反调试技详解术 检测调试器的原理与防护实践
android·ios·小程序·https·uni-app·iphone·webview
Lvan的前端笔记10 小时前
AndroidX 完全入门指南
android·androidx
帅次11 小时前
Android 应用高级面试:Window 近1年高频追问 18 题
android·面试·职场和发展
总捣什么乱111 小时前
MySQL MySQL是怎么保证主备一致的?
android·mysql·adb
zzm62812 小时前
精读 HinDroid:基于异构信息网络的安卓恶意软件检测
android
weixin_4407841112 小时前
Android基础知识汇总
android·java·android studio