简体   繁体   中英

memory leak while capturing image from camera

there was a strange issue happening in my app, the issue is while I try to capture images from camera like 4-5 images captured using camera. there is a memory leak showing in instruments.

Due to this memory leaks if I put my app in background and lock the screen the iphone restarts.

please check the screen shot of the leak information泄露

I'm using a simple picker to capture image from camera and then dismissing it. then why is there this leak.

let picker = UIImagePickerController()

 picker.delegate = self
 picker.allowsEditing = false

 picker.sourceType = .camera
 self.present(picker, animated: true)



public func imagePickerController(_ picker: UIImagePickerController,
                                  didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey: Any]) {
    if let image = info[.originalImage] as? UIImage {
        processSelectedImage(image: image)
    }
    picker.dismiss(animated: true, completion: nil)
}

有关崩溃的更多信息

This is due to low memory of your device and a lot of other processes are running in app, try to cleanup the device and try again.

Better way is to restart your device and run again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM