We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
举一个例子 listener是匿名内部类会持有UI层比如fragment的引用 如果网络比较慢listener异步请求 又销毁了fragment就会有泄露的风险 共同学习 现在已知的解决方法就是利用弱引用 加静态匿名内部类的方法避免 public void showBanncerPage(final RequestImpl listener) { Subscription subscription = HttpUtils.getInstance().getDongTingServer().getFrontpage() .observeOn(AndroidSchedulers.mainThread()).subscribeOn(Schedulers.io()) .subscribe(new Observer() { @OverRide public void onCompleted() { }
@Override public void onError(Throwable e) { listener.loadFailed(); } @Override public void onNext(FrontpageBean frontpageBean) { listener.loadSuccess(frontpageBean); } }); listener.addSubscription(subscription); }
The text was updated successfully, but these errors were encountered:
嗯恩 没有很严谨,我再完善一下,那个页面在首页里,退出的话就退出App了,不过有其他子页面用到就内存泄漏了。非常感谢提出!
Sorry, something went wrong.
No branches or pull requests
举一个例子
listener是匿名内部类会持有UI层比如fragment的引用
如果网络比较慢listener异步请求 又销毁了fragment就会有泄露的风险
共同学习 现在已知的解决方法就是利用弱引用 加静态匿名内部类的方法避免
public void showBanncerPage(final RequestImpl listener) {
Subscription subscription = HttpUtils.getInstance().getDongTingServer().getFrontpage()
.observeOn(AndroidSchedulers.mainThread()).subscribeOn(Schedulers.io())
.subscribe(new Observer() {
@OverRide
public void onCompleted() {
}
The text was updated successfully, but these errors were encountered: