Before starting the YPImagePicker from my app, I'm around 40MB of used memory (real device).
So, after opening, using some filters, dismissing a couple of times, the used memory is easily at 500MB.
Can you please look at this?
@theolof
Thanks for such a detailed explanation.
The picker will always use quite a lot of resources since tapping into the camera library and filters
are memory usages but it should let go of them as soon as it's over.
This looks like an issue then, thanks for the eagle eye !
I am going to look at this into more detail :)
Cheers,
@theolof by the way have you found a way to add the Swedish translations?
@theolof
I have found an issue in the example project. The picker's callback was creating a retain cycle so that the picker would still live in memory after being dismissed.
I don't know if you were dismissing the picker that way in your app, but adding [unowed picker] will break this retain cycle and allow for the whole hierarchy to be released (Library / Photo/ Video / Filters ...)
func showPicker() {
let picker = YPImagePicker()
picker.showsVideo = true
picker.videoCompression = AVAssetExportPreset640x480
// `unowned` is Mandatory since it would create a retain cycle otherwise :)
picker.didSelectImage = { [unowned picker] img in
self.imageView.image = img
picker.dismiss(animated: true, completion: nil)
}
present(picker, animated: true, completion: nil)
}
Before 10 subsequent launch would take up around 300MB in memory and with the fix it goes down to around 70MB. (Starting memory being around 70MB)
Let me know if that helps :)
Have a fantastic day!
@theolof any updates?
Thanks, it fixes the problem.
@theolof Awesome ! Thanks :)
Most helpful comment
@theolof
I have found an issue in the example project. The picker's callback was creating a retain cycle so that the picker would still live in memory after being dismissed.
I don't know if you were dismissing the picker that way in your app, but adding
[unowed picker]will break this retain cycle and allow for the whole hierarchy to be released (Library / Photo/ Video / Filters ...)Before 10 subsequent launch would take up around 300MB in memory and with the fix it goes down to around 70MB. (Starting memory being around 70MB)
Let me know if that helps :)
Have a fantastic day!