Closed ittianyu closed 7 years ago
hard to say. Are you using the GoogleApiClient? Are you forgetting to unregister callbacks or disconnect the client? A minimal sample app would greatly help.
I have done what I can to release on destroy. But still leak.
@SuppressWarnings("MissingPermission")
@Override
public void onDestroy() {
if (null != presenter)
presenter.onDestroy();
RxUtils.dispose(keywordDisposable);
locationsMap.clear();
if (mMap != null) {
removeMapListeners();
if (mLocationPermissionGranted)
mMap.setMyLocationEnabled(false);
mMap.clear();
}
if (mGoogleApiClient != null) {
mGoogleApiClient.disconnect();
mGoogleApiClient.stopAutoManage(getActivity());
mGoogleApiClient.unregisterConnectionCallbacks(this);
mGoogleApiClient.unregisterConnectionFailedListener(this);
mGoogleApiClient = null;
}
// should be call after map clear
super.onDestroy();
}
onDestroy isn't guaranteed to be called. Try moving your teardown logic to onStop instead, which is guaranteed to be called in API 11+. Either way, this doesn't appear to be a LeakCanary bug.
(the only case where Activity.onDestroy
will not be called is when the entire process is killed, so that might not be it.)
Same thing happened to me. Only on some specific devices. Seems that Thread
is storing some references in native code.
Is it a sytem issue ? It only happens on this phone.