Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SkinCompatDelegate中的mSkinHelpers貌似有内存泄漏 #476

Open
528787067 opened this issue Nov 8, 2022 · 0 comments
Open

SkinCompatDelegate中的mSkinHelpers貌似有内存泄漏 #476

528787067 opened this issue Nov 8, 2022 · 0 comments

Comments

@528787067
Copy link

SkinCompatDelegate中的mSkinHelpers使用虚引用持有所有支持换肤的view,虽然view会随着页面关闭自动回收,但是对应被mSkinHelpers 这个列表持有的 WeakReference 对象本身貌似不会被回收,会一直存在 mSkinHelpers 列表中,不断的 onCreateView 貌似会使 mSkinHelpers 列表不断增长。所以这里每次 add 对象到 mSkinHelpers 列表的时候是否需要添加清理掉列表中被回收的对象的逻辑?或者换肤遍历列表的时候清理无用对象?或者调整这里的逻辑,不使用列表来持有可换肤view对象,而是构造view的时候使用 addOnAttachStateChangeListener,在 onViewAttachedToWindow 里面注册换肤监听,onViewDetachedFromWindow 反注册换肤监听?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant