Find-Unity-ManagedStaticReferences:查找Unity ManagedStaticReferences

时间:2021-05-14 01:56:28
【文件属性】:
文件名称:Find-Unity-ManagedStaticReferences:查找Unity ManagedStaticReferences
文件大小:2KB
文件格式:ZIP
更新时间:2021-05-14 01:56:28
unity profiler unity3d memory-leak staticreferences Find-Unity-ManagedStaticReferences 当我们使用 Unity Profiler 查看内存时,经常有些贴图等资源的引用只有一个 ManagedStaticReferences() 引用,怎么都卸载不掉。 使用 Memory Profiler 也查找不到谁引用的。现在终于找到方法,开心,分享给大家。 具体思路: 维护一个 key 是 物件 Hierarchy 路径, value 是 WeakReference 的字典,收集所有可能会泄漏的组件 在需要 Check 的物件挂靠的脚本里 添加该 Componet 的 弱引用到字典 查看 Alive 状态,Alive 为 true ,但 target 为空的即为泄漏者,打印他的路径 如果单纯查找 UI 贴图的内存泄漏,例如 NGUI 可以只在 UIWidget 的 Awake 里添加弱引用到字典, UGUI 的话需要
【文件预览】:
Find-Unity-ManagedStaticReferences-master
----README.md(3KB)

网友评论