LiveEventBus icon indicating copy to clipboard operation
LiveEventBus copied to clipboard

经常出现内存泄漏

Open budaowengd opened this issue 4 years ago • 5 comments

image

budaowengd avatar Sep 07 '20 12:09 budaowengd

Forever模式订阅消息,需要调用removeObserver取消订阅 void observeForever(@NonNull Observer<T> observer)

JeremyLiao avatar Sep 15 '20 08:09 JeremyLiao

我没有使用observeForever进行注册, 是通过obserer 传入 fragment 进行注册的, 会经常出现内存泄漏

budaowengd avatar Sep 23 '20 03:09 budaowengd

@luoxiong94 老铁,最终查到是因为这个obserer内存泄露吗?通常LiveData传Fragment自己的LifecycleOwner应该会自动解绑才对,我们正打算引用这个,看到了你说的这个坑。。。

DarkHorsePXF avatar Nov 24 '20 03:11 DarkHorsePXF

我最近也遇到了内存泄漏,目前在查找原因

hgncxzy avatar Dec 25 '20 03:12 hgncxzy

@ #115 我遇到了类似的问题,不过不是因为框架问题,因为我用了navigation原因, fragment创建了两次,导致有一个observer没有被destroy正常释放,参考: https://stackoverflow.com/questions/64414301/why-onviewcreated-is-called-twice-in-android-app-using-navigation-components

ghost avatar Jul 08 '21 06:07 ghost