Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的项目中有内存泄漏。为了找出漏洞,我决定使用 Android Studio Profiler。经过大量研究。我停留在实例列表和参考之间如何识别确切的泄漏点。
下面是我的分析器的屏幕截图:
内存分析器
请帮助我了解确切的泄漏原因以避免内存泄漏。
提前致谢。
当您保留活动或片段超过其生命周期时,Android Studio 的内存分析器会检测到特定类别的泄漏。
该References选项卡显示了泄漏的活动或片段是如何被保留的。您可以尝试点击Show nearest GC root only查看到 GC root 的最短路径,这可能会让您对如何停止保留对象并消除泄漏有所了解。
References
Show nearest GC root only