-
Notifications
You must be signed in to change notification settings - Fork 588
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
Update ScanOperationApi21.java - Fixing the memory leak from ScanOperationApi21 emitter #708
Update ScanOperationApi21.java - Fixing the memory leak from ScanOperationApi21 emitter #708
Conversation
Fixing the memory leak from ScanOperationApi21 emitter
Hello! |
Hi @dariuszseweryn , any updates from Leak Canary? Regarding to the race condition on the callback. Do you have a preferred way for me to fix it? Thanks |
No updates yet, I am fully occupied :/ |
@dariuszseweryn I'm observing a problem with the library after prolonged used, namely after several hours spent on reconnect attempts (no scanning, but thousands of connect attempts) - it looks like afterwards flutter_ble_lib is not operational anymore and any attempt to initate scanning fails instantly as the stream is closed (onDone is called instantly). |
- Keeping ref to scanEmitter inside the functions to avoid race condition when the callback is being nullified on a different thread.
@dariuszseweryn made another PR with the fix you wanted I don't see any leak with LeakCanary after calling scanBleDevices() and closing the activity |
@b055man Have you reported this issue on Flutter lib repo? I have not seen anything like that yet. |
@dariuszseweryn Sorry for not updating this. The root cause for this problem has been identified already - I've an issue here: dotintent/FlutterBleLib#528 The original cause has been resolved in the RxAndroidBle RxJava2-based version of the lib but FlutterBleLIb/MultiplatformBleAdapter was (still is, to be precise) based on the earlier version. |
Fixing the memory leak from ScanOperationApi21 emitter
Fixing the issue: #607