mrmans0n / smart-location-lib

Android library project that lets you manage the location updates to be as painless as possible
1.65k stars 352 forks source link

Possible to solve memory leak #240

Open mortenholmgaard opened 6 years ago

mortenholmgaard commented 6 years ago

This change make it possible to fix a memory leak in leaking listener in LocationGooglePlayServicesProvider.java and LocationGooglePlayServicesWithFallbackProvider.java

private var locationControl: SmartLocation.LocationControl? = null
locationControl = SmartLocation.with(context).location()
locationControl!!.oneFix().start { location ->
...
}

override fun onDestroy() {
    locationControl?.destroy()
    super.onDestroy()
}
ugurcany commented 6 years ago

@mrmans0n please merge this pull request since it resolves a critical memory leak issue. thanks for the library.

christocracy commented 6 years ago

@mortenholmgaard if you hope to have a PR taken seriously, you might want to rebase your branch before submitting:

mortenholmgaard commented 6 years ago

I do not really expect it to be merge because there do not seem to any activity on this lib from the author any way, so it was mostly for my self and others with same problem. So I did not want to spend time on it.