googlesamples / googlesamples/mlkit

using Google MLKit Barcode scanning memory leak

Open
#957 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
4.3k
Forks
3.1k
PR merge metrics
No merged PRs in 30d

Description

I used the following code:

private var zoomCallback = ZoomSuggestionOptions.ZoomCallback { zoomLevel: Float ->
camera!!.cameraControl.setZoomRatio(zoomLevel)
true
}
private var barcodeScanner = BarcodeScanning.getClient(
BarcodeScannerOptions.Builder()
.setBarcodeFormats(Barcode.FORMAT_QR_CODE)
.setZoomSuggestionOptions(ZoomSuggestionOptions.Builder(zoomCallback).build())
.build()
)

override fun onDestroy() {
super.onDestroy()
barcodeScanner.close()
}

Always in GC when service is destroyed
I tried removing "camera!!.cameraControl.setZoomRatio(zoomLevel)"
Fixed memory leak
What is the reason?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.