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

Fragment缓存View导致内存泄漏 #16

Closed
crowforkotlin opened this issue Nov 27, 2022 · 9 comments
Closed

Fragment缓存View导致内存泄漏 #16

crowforkotlin opened this issue Nov 27, 2022 · 9 comments
Labels
bug 🐛程序异常 enhancement ✨功能增强 help wanted 🚸请求协助 invalid ❌不当话题

Comments

@crowforkotlin
Copy link

fragment切回时会导致重走onCreateView,这导致了内存泄漏
582cad92f57e8a239f1573e355b5de8

@fumiama
Copy link
Owner

fumiama commented Nov 28, 2022

这个我解决不了,因为我不是专业开发者(
有解决办法的欢迎PR代码

@fumiama fumiama closed this as not planned Won't fix, can't repro, duplicate, stale Nov 28, 2022
@fumiama fumiama added bug 🐛程序异常 enhancement ✨功能增强 help wanted 🚸请求协助 invalid ❌不当话题 labels Nov 28, 2022
@fumiama fumiama pinned this issue Nov 28, 2022
fumiama added a commit that referenced this issue Nov 28, 2022
@fumiama
Copy link
Owner

fumiama commented Nov 28, 2022

尝试修了一下,但是不确保完全修复

@crowforkotlin
Copy link
Author

这个问题就得涉及到FragmentNavigation的源码了,navigate的方式在实际用的是fragmentmanager的replace,所以才需要缓存view避免视图重新刷新,这个问题感觉非常逆天(https://issuetracker.google.com/issues/127932815?pli=1)可以看这个链接的对话。 限制navigation的问题最大的问题我感觉就只有缓存方式了,如果要修复直接拷贝navigation的类去修复或者缓存view(但是会内存泄漏)其他问题还有很多,我现在已经打算弃用这个导航了,直接使用fragmentManger手动管理show、replace、hide

@crowforkotlin
Copy link
Author

项目过于庞大和屎山,Pr不太合适,建议重0开始...

@fumiama
Copy link
Owner

fumiama commented Nov 28, 2022

我的态度是,能用就行,毕竟我不是专业写安卓的。谁想从零开始就交给他自己吧。😂

@crowforkotlin
Copy link
Author

问一下老哥这个接口怎么搞到手的?我打算自己搞一个这个试试

@crowforkotlin
Copy link
Author

我在想作者是不是抓包拿到的数据和接口😂

@m122469119
Copy link

林子大了;

@fumiama
Copy link
Owner

fumiama commented Nov 28, 2022

当然是抓包了😂你可以试试http canary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛程序异常 enhancement ✨功能增强 help wanted 🚸请求协助 invalid ❌不当话题
Projects
None yet
Development

No branches or pull requests

3 participants