You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the example project, if add the "deinit" on "class CropController: DocumentCropController".
After you do the process to crop image etc, and go back to the "ScannerController" the class "CropController" never call the "deinit". And using instruments, I notice a possible memory leak!
Thanks!
The text was updated successfully, but these errors were encountered:
I was able to track and fix the memory leak issue!
1st: To fix the issue with the "deinit" never been called, we need to change the Outlet imageView var to weak var. Follow the class name and the corrected var: open class DocumentCropViewController: UIViewController { ... @IBOutlet public weak var imageView: UIImageView!
Another change to get the "deinit" to finally work, I made a workaround, and it's welcome if there's a better way to fix it, so follow the class and the function name that I added the follow lines at the end:
`public final class VisionImageRectangleDetector: ImageRectangleDetector {
.....
private func handleRequest(request: VNRequest, error: Error?) {
.....
let when = DispatchTime.now() + 1 //Change the 1 to desired number in seconds
DispatchQueue.main.asyncAfter(deadline: when){ [unowned self] in
self.completionHandler = nil
}`
And finally to fix the memory leak issue: public class SECropView: UIView { .... fileprivate weak var imageView : UIImageView?
And there's another memory leak issue related to the CropView framework that was holding the picture in memory in the class "SECropView" "imageView", and I open a ticket in here
In the example project, if add the "deinit" on "class CropController: DocumentCropController".
After you do the process to crop image etc, and go back to the "ScannerController" the class "CropController" never call the "deinit". And using instruments, I notice a possible memory leak!
Thanks!
The text was updated successfully, but these errors were encountered: