blinkid-ios
blinkid-ios copied to clipboard
Memory leak when using in SwiftUI
Step 1: Are you in the right place?
- Yes, issue also affects the sample SwiftUI code in this repository
Step 2: Describe your environment
- Xcode version: 14.2 (14C18)
- Test Device: iPad mini (6th generation), OS: 16.3.1
- BlinkID SDK version: 6.1.1
- What are you trying to scan: German sample ID card image (https://www.google.hu/url?sa=i&url=https%3A%2F%2Fglobaldocumentservice.com%2Fproduct%2Ffake-german-id-card%2F&psig=AOvVaw01I_k1tQjv8hW4FvVnaBI_&ust=1678549488366000&source=images&cd=vfe&ved=0CBAQjRxqFwoTCPi4iKLa0f0CFQAAAAAdAAAAABAF)
Step 3: Describe the problem
If the scanning view is used inside a SwiftUI view, and I try to scan an image which is hard to scan for some reason, the memory usage jumps significantly, even above 1-2 GB, causing the app to crash eventually.
I've tried to use the SDK in SwiftUI in many different ways, but could not pinpoint the cause of the memory leak, I've also tried out the code from the Sample folder and the issue still persists.
The issue is not critical, as it is only causing a problem if a document is very hard to read, I could only test it with a fake ID card, but it indicates a serious memory leak in the SDK.
Step 4: Relevant code
Try to scan a hard-to-read (e.g. Text overlay on the image) document with the sample SwiftUI code in this repository and monitor memory usage.
Hello @gburai , thank you for reaching out and reporting this issue. Would you mind sharing the exception you get so we can analyze it? We will also try to reproduce it on our side and will follow up with the findings.
Thank you for your quick response. I'm not sure if this would be of help:
The app “...” on Gergo’s iPad quit unexpectedly. Domain: IDEDebugSessionErrorDomain Code: 11 Failure Reason: Message from debugger: Terminated due to memory issue User Info: { DVTErrorCreationDateKey = "2023-03-20 09:16:21 +0000"; IDERunOperationFailingWorker = DBGLLDBLauncher; }
Analytics Event: com.apple.dt.IDERunOperationWorkerFinished : { "device_model" = "iPad14,1"; "device_osBuild" = "16.3.1 (20D67)"; "device_platform" = "com.apple.platform.iphoneos"; "launchSession_schemeCommand" = Run; "launchSession_state" = 2; "launchSession_targetArch" = arm64; "operation_duration_ms" = 73908; "operation_errorCode" = 11; "operation_errorDomain" = IDEDebugSessionErrorDomain; "operation_errorWorker" = DBGLLDBLauncher; "operation_name" = IDEiPhoneRunOperationWorkerGroup; "param_consoleMode" = 0; "param_debugger_attachToExtensions" = 0; "param_debugger_attachToXPC" = 1; "param_debugger_type" = 5; "param_destination_isProxy" = 0; "param_destination_platform" = "com.apple.platform.iphoneos"; "param_diag_MainThreadChecker_stopOnIssue" = 0; "param_diag_MallocStackLogging_enableDuringAttach" = 0; "param_diag_MallocStackLogging_enableForXPC" = 1; "param_diag_allowLocationSimulation" = 1; "param_diag_checker_tpc_enable" = 1; "param_diag_gpu_frameCapture_enable" = 0; "param_diag_gpu_shaderValidation_enable" = 0; "param_diag_gpu_validation_enable" = 0; "param_diag_memoryGraphOnResourceException" = 0; "param_diag_queueDebugging_enable" = 1; "param_diag_runtimeProfile_generate" = 0; "param_diag_sanitizer_asan_enable" = 0; "param_diag_sanitizer_tsan_enable" = 0; "param_diag_sanitizer_tsan_stopOnIssue" = 0; "param_diag_sanitizer_ubsan_stopOnIssue" = 0; "param_diag_showNonLocalizedStrings" = 0; "param_diag_viewDebugging_enabled" = 1; "param_diag_viewDebugging_insertDylibOnLaunch" = 1; "param_install_style" = 0; "param_launcher_UID" = 2; "param_launcher_allowDeviceSensorReplayData" = 0; "param_launcher_kind" = 0; "param_launcher_style" = 0; "param_launcher_substyle" = 0; "param_runnable_appExtensionHostRunMode" = 0; "param_runnable_productType" = "com.apple.product-type.application"; "param_runnable_type" = 2; "param_testing_launchedForTesting" = 0; "param_testing_suppressSimulatorApp" = 0; "param_testing_usingCLI" = 0; "sdk_canonicalName" = "iphoneos16.2"; "sdk_osVersion" = "16.2"; "sdk_variant" = iphoneos; }
System Information
macOS Version 13.2.1 (Build 22D68) Xcode 14.2 (21534) (Build 14C18) Timestamp: 2023-03-20T10:16:21+01:00
Hi @gburai
Following up on the thread.
We've figured out what is causing the memory leak, and the issue will be fixed in the next (6.2.0) release. Once the new version has been released, I will notify you here.