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 when using in SwiftUI #395

Open
gburai opened this issue Mar 17, 2023 · 3 comments
Open

Memory leak when using in SwiftUI #395

gburai opened this issue Mar 17, 2023 · 3 comments

Comments

@gburai
Copy link

gburai commented Mar 17, 2023

Step 1: Are you in the right place?

  • Yes, issue also affects the sample SwiftUI code in this repository

Step 2: Describe your environment

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.

@MBrizic01
Copy link

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.

@gburai
Copy link
Author

gburai commented Mar 20, 2023

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

@mparadina
Copy link
Contributor

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.

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

3 participants