flutter-ml / google_ml_kit_flutter

A flutter plugin that implements Google's standalone ML Kit
MIT License
915 stars 708 forks source link

Crash on iOS when using Text Recognition and Barcode scanning #592

Open Saad29 opened 4 months ago

Saad29 commented 4 months ago

Title: Memory

Describe the bug I am using both google_mlkit_barcode_scanning: ^0.10.0 and google_mlkit_text_recognition: ^0.11.0 for a scanner app which scans both text and barcode/QR code. On my iphone 7, the app crashes with the following report. It only crashes on iphone 7, on higher devices it overheats but does not crash.

Initialized TensorFlow Lite runtime.
INFO: Initialized TensorFlow Lite runtime.
Created TensorFlow Lite XNNPACK delegate for CPU.
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
... tracking ...
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_RESOURCE (RESOURCE_TYPE_MEMORY: high watermark memory limit exceeded) (limit=1450 MB)
    frame #0: 0x00000001dc3d7884 libsystem_platform.dylib`_platform_memmove + 100
libsystem_platform.dylib`:
->  0x1dc3d7884 <+100>: stnp   x8, x9, [x3]
    0x1dc3d7888 <+104>: stnp   x10, x11, [x3, #0x10]
    0x1dc3d788c <+108>: add    x3, x3, #0x20
    0x1dc3d7890 <+112>: ldnp   x8, x9, [x1]
Target 0: (Runner) stopped.
Lost connection to device.
the Dart compiler exited unexpectedly.

Platform (please complete the following information):

I have seen in previous issues like https://github.com/flutter-ml/google_ml_kit_flutter/issues/393 some fixes were applied related to the selfie plugin, maybe something similar can be done for text recognition and barcode scanning?