Karumi / Dexter

Android library that simplifies the process of requesting permissions at runtime.
http://karumi.com
Apache License 2.0
5.23k stars 671 forks source link

it leaks memory with simple usage case. #175

Closed aalap03 closed 7 years ago

aalap03 commented 7 years ago

I am using dexter with this scenario in my fragment and it leaks a lot of memory gradually around 10MBs. Is there any solution or work around to this ?

Dexter.withActivity(context)
                .withPermission(Manifest.permission.ACCESS_FINE_LOCATION)
                .withListener(new PermissionListener() {
                    @Override
                    public void onPermissionGranted(PermissionGrantedResponse response) {

                        if (locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER) && mGoogleApiClient != null && mGoogleApiClient.isConnected()) {

                            if (Build.VERSION.SDK_INT >= 23) {
                                if (checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED)

                            } else {

                            }

                            Utils.toggleLoader(loadingFrame, true);

                        } else {
                            if (!locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER))
                                openGPSDialog();
                        }

                    }

                    @Override
                    public void onPermissionDenied(PermissionDeniedResponse response) {

                        Toasty.info(context, getString(R.string.toast_perm_denied_location)).show();
                    }

                    @Override
                    public void onPermissionRationaleShouldBeShown(PermissionRequest permission, PermissionToken token) {
                        token.continuePermissionRequest();
                    }
                })
                .check();
Serchinastico commented 7 years ago

Hi @aalap03,

How are you verifying there is a memory leak? Have you verified it's effectively in Dexter? What version of the library are you using?

Next time, please follow the issue template or we will close it right away.

aalap03 commented 7 years ago

@Serchinastico Apologies for incomplete information, so I am verifying with LeakCanary, and the version is 4.1.0. This is the latest screen shots I have from leak canary.

screen shot 2017-08-17 at 10 31 07

aalap03 commented 7 years ago

Closing it as decided not to use library and go with android implementation.

oa-azab commented 6 years ago

got same result from leakcanary on version 4.1.0