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

Memory Leak #106

Closed
mtrakal opened this issue Dec 8, 2015 · 2 comments
Closed

Memory Leak #106

mtrakal opened this issue Dec 8, 2015 · 2 comments

Comments

@mtrakal
Copy link
Contributor

mtrakal commented Dec 8, 2015

Hello,

we use LeakCanary for finding leaks and we found one in this lib.
It looks, that problem is in Google Play Services, but it can be fixed by lib maybe?

We call:

mOnLocationUpdatedListener = new OnLocationUpdatedListener() {
            @Override
            public void onLocationUpdated(Location location) {
                ...
            }
        };
        SmartLocation.with(getApplicationContext()).location()
                .oneFix()
                .start(mOnLocationUpdatedListener);

Get:

references com.google.android.gms.location.internal.zzd$1.zzaLI (anonymous class extends com.google.android.gms.location.internal.zzd$zza)
* references io.nlopez.smartlocation.location.providers.LocationGooglePlayServicesProvider.listener

I found an relevant thread on StackOverflow:
http://stackoverflow.com/questions/32937897/why-is-this-memory-leak-occurs-android-leakcanary
https://code.google.com/p/gmaps-api-issues/issues/detail?id=8111

It could be maybe fixed in Google Play services 8.3.x (but maybe not).

Detail log

* NewRecordActivity has leaked:
* GC ROOT com.google.android.gms.location.internal.zzd$zzb.zzakL
* references com.google.android.gms.location.internal.zzd$1.zzaLI (anonymous class extends com.google.android.gms.location.internal.zzd$zza)
* references io.nlopez.smartlocation.location.providers.LocationGooglePlayServicesProvider.listener
* references NewRecordActivity$13$1.this$1 (anonymous class implements io.nlopez.smartlocation.OnLocationUpdatedListener)
* references NewRecordActivity$13.this$0 (anonymous class implements java.lang.Runnable)
* leaks NewRecordActivity instance

* Reference Key: beec1e74-41bf-4b3b-819d-104cb8ab06a3
* Device: Elephone Elephone Elephone P6000 hermes
* Android Version: 5.0.2 API: 21 LeakCanary: 1.3.1
* Durations: watch=14875ms, gc=237ms, heap dump=2008ms, analysis=24870ms

* Details:
* Instance of com.google.android.gms.location.internal.zzd$zzb
| zzakL = com.google.android.gms.location.internal.zzd$1 [id=0x13db5d80]
| mDescriptor = java.lang.String [id=0x1401cd80]
| mOwner = com.google.android.gms.location.internal.zzd$zzb [id=0x1401cd60]
| mObject = 367689304352
* Instance of com.google.android.gms.location.internal.zzd$1
| zzaLH = com.google.android.gms.location.LocationRequest [id=0x13980780]
| zzaLI = io.nlopez.smartlocation.location.providers.LocationGooglePlayServicesProvider [id=0x13956180]
| zzaLJ = com.google.android.gms.location.internal.zzd [id=0x1394b850]
| zzacX = com.google.android.gms.common.api.Api$zzc [id=0x1394b810]
| zzafc = java.util.concurrent.atomic.AtomicReference [id=0x13ce6be0]
| zzaeT = null
| zzafd = java.lang.Object [id=0x13ce6bc0]
| zzafe = com.google.android.gms.internal.zzly$zza [id=0x1401cc60]
| zzaff = java.util.ArrayList [id=0x1401cc00]
| zzafg = null
| zzafj = null
| zzafk = null
| zzafl = null
| zzpy = java.util.concurrent.CountDownLatch [id=0x13ce6bd0]
| zzL = false
| zzafh = true
| zzafi = false
* Instance of io.nlopez.smartlocation.location.providers.LocationGooglePlayServicesProvider
| static $staticOverhead = byte[] [id=0x13c5b421;length=24;size=40]
| static GMS_ID = java.lang.String [id=0x1382d940]
| static REQUEST_CHECK_SETTINGS = 20001
| static REQUEST_START_LOCATION_FIX = 10001
| client = com.google.android.gms.internal.zzmg [id=0x135c2d00]
| context = .Application [id=0x12d0b400]
| googlePlayServicesListener = io.nlopez.smartlocation.location.providers.LocationGooglePlayServicesWithFallbackProvider [id=0x13356040]
| listener = .NewRecordActivity$13$1 [id=0x13a2b190]
| locationRequest = com.google.android.gms.location.LocationRequest [id=0x13980780]
| locationStore = io.nlopez.smartlocation.location.LocationStore [id=0x1394b790]
| logger = io.nlopez.smartlocation.utils.LoggerFactory$Sssht [id=0x1394b360]
| settingsResultCallback = io.nlopez.smartlocation.location.providers.LocationGooglePlayServicesProvider$1 [id=0x1394b4e0]
| checkLocationSettings = false
| fulfilledCheckLocationSettings = false
| shouldStart = true
| stopped = false
@mrmans0n
Copy link
Owner

I updated to Play Services 8.4, hopefully it is fixed now.

@rohankandwal
Copy link

The issue is not fixed, you might be able to add a work around in the library from the code https://code.google.com/p/gmaps-api-issues/issues/detail?id=8111#c9. If not, any suggestion as to how we can do it from our side? I have created a new issue for this #155 , I am leaking 17 Mb of memory.

@hashlin hashlin mentioned this issue Aug 15, 2018
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

3 participants