Leakcanary Report Of Memory Leak Using Otto
Following up on my last question, here is the second memory leak I can not get rid of.. I read that I need to register and unregister my static Otto bus according to the Activity a
Solution 1:
You are using watching the reference at the wrong time. You should only call watch(thing)
when you are absolutely certain that thing
will be garbage collected. For your Activities and Fragments, you will want something like this:
@OverridepublicvoidonDestroy() {
super.onDestroy();
RefWatcherrefWatcher= ExampleApplication.getRefWatcher(getActivity());
refWatcher.watch(this);
}
That is from the LeakCanary FAQ "How do I use it?" section
Post a Comment for "Leakcanary Report Of Memory Leak Using Otto"