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

内存泄漏 #45

Open
kehanchenk opened this issue Jun 15, 2017 · 3 comments
Open

内存泄漏 #45

kehanchenk opened this issue Jun 15, 2017 · 3 comments

Comments

@kehanchenk
Copy link

直接通过inject注入mPresenter,baseActivity没有处理,这个存在内存泄漏的问题吧

@Rukey7
Copy link
Owner

Rukey7 commented Jun 15, 2017

没有吧,你觉得怎么造成内存泄漏

@kehanchenk
Copy link
Author

Presenter 注入操作都会创建一个实例, 比如 NewsMainPresenter,它是持有 当前 Fragment 的引用的。你没有释放操作,这个会存在内存泄漏的吧?
还有一个问题请教下 ,通过注入之后

public IRxBusPresenter provideMainPresenter(DaoSession daoSession, RxBus rxBus) {
        return new NewsMainPresenter(mView, daoSession.getNewsTypeInfoDao(), rxBus);
    }

为什么 NewsMainPresenter 中能直接使用 rxbus 和 daoSession ,不应该都没实例化吗?为什么不是 null,
求答疑

@Rukey7
Copy link
Owner

Rukey7 commented Jun 16, 2017

Fragment 销毁对应的 Presenter 也会销毁,关于rxbus 和 daoSession 都在 Application 那边创建了,全局用的是同一个单例

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

2 participants