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 caused by the ConnectionsClient #39

Open
ekigamba opened this issue Apr 17, 2019 · 1 comment
Open

Memory leak caused by the ConnectionsClient #39

ekigamba opened this issue Apr 17, 2019 · 1 comment

Comments

@ekigamba
Copy link
Contributor

ekigamba commented Apr 17, 2019

I have tested this on two devices (Samsung table Android 7.0 and itel mobile phone Android 6.0) where one is advertising and the other is discovering. The leak seems to happen on both devices irrespective of which device disconnects from the endpoint first. The code for the Nearby Connections API seems to not be open-source or available through the usual channels and I could not pinpoint the issue further.

This is what my cleanup code looks like

        view.dismissAllDialogs();
        view.enableSendReceiveButtons(true);

        interactor.stopAdvertising();
        interactor.stopDiscovering();

        if (getCurrentPeerDevice() != null) {
            interactor.disconnectFromEndpoint(getCurrentPeerDevice().getEndpointId());
        }

        setCurrentDevice(null);

The code does call the disconnectFromEndpoint which calls the single instance of the connectionsClient

https://issuetracker.google.com/issues/129429944

The onConnectionBroken or onConnectionUnknownErroror onDisconnected seem to be called after exiting the activity and after the cleanup code has been called

@ekigamba
Copy link
Contributor Author

ekigamba commented May 2, 2019

This might need to be tested with the itel device which is pretty slow. It is not easily replicable using fast devices

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

1 participant