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 #75

Open
siddharthuohyd opened this issue Dec 18, 2017 · 2 comments
Open

Memory Leak #75

siddharthuohyd opened this issue Dec 18, 2017 · 2 comments

Comments

@siddharthuohyd
Copy link

siddharthuohyd commented Dec 18, 2017

Getting leak of 4.7KB using this library.Added the screenshot also for better clarity.This is the snippet that I have used in my project which gets the leak which is determined by the Leak Canary tool.

  private void fingerprintAuthentication() {
    if (RxFingerprint.isAvailable(getAppContextFromView())) {
        mDisposable = RxFingerprint.authenticate(getAppContextFromView())
                .subscribeOn(Schedulers.io())
                .subscribe(fingerprintAuthenticationResult -> {
                    switch (fingerprintAuthenticationResult.getResult()) {
                        case FAILED:
                            Toast.makeText(getAppContextFromView(),
                                    R.string.error_finger_print_not_valid,
                                    Toast.LENGTH_SHORT).show();
                            if (mFingerPrintTouchCallBack != null) {
                                mFingerPrintTouchCallBack.onAuthenticationFailed();
                            }

                            break;
                        case HELP:
                            Toast.makeText(getAppContextFromView(),
                                    fingerprintAuthenticationResult.getMessage(),
                                    Toast.LENGTH_SHORT).show();
                            break;
                        case AUTHENTICATED:
                            if (mFingerPrintTouchCallBack != null) {
                                mFingerPrintTouchCallBack.onAuthenticationSuccess();
                                mConfirmPinPresenter.pinUpdated();
                            }
                            break;
                    }
                }, throwable -> {
                    if (throwable instanceof FingerprintAuthenticationException) {
                        if (throwable.getMessage() != null && throwable.getMessage()
                                .contains(
                                        TOO_MANY_ATTEMPT_STR)) {
                            Toast.makeText(getAppContextFromView(),
                                    throwable.getMessage(),
                                    Toast.LENGTH_SHORT).show();
                            mConfirmPinPresenter.logout();
                        }
                    }
                });
    }
}

screenshot_20171218-142955

@Mauin
Copy link
Owner

Mauin commented Dec 22, 2017

Thanks for reporting this leak. I'll take a look at it and see if there is anything we can improve in RxFingerprint or if the FingerprintManager internally is causing this leak.

@kotoMJ
Copy link

kotoMJ commented Feb 11, 2019

I had similar issue and it seems to be FingerprintManager issue. The workaround is described here: https://stackoverflow.com/questions/53481621/memory-leak-but-how-can-i-pass-a-different-context-than-the-one-of-the-activity

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