[BUG] Memory leak and solution
Issue: The memory has not been released after the view is dismissed.
Reason: Retain cycle
Solution:
Add weak to all parent variables
I’m experiencing the same issue. Although I set the weak, it didn’t resolve the problem. Have you discovered any other potential solutions on this matter?
After changing all parent references to weak, the memory leak was resolved.
I also tested memory usage upon view dismissed and added deinit to all related classes for debugging:
CameraManagerPhotoOutput CameraManagerVideoOutput CameraMetalView CameraGridView CameraManagerMotionManager CameraManagerNotificationCenter
@samchen7910 why not push up a PR?
Thanks for PR, @pauluhn. I've been swamped settling stuff into my new home.
There is still an error. When I use the camera in fullScreenCover, it crashes when I dismiss it because the parent=nil.
Stumbled upon this issue (without noticing the memory leak myself). I've opened #104 with a fix. Not sure when this will be approved, but in meantime you can point SPM to commit 857a08ee75060193e82c1fc9822a3b9f1688ff42 and get the fix in!
Cc: @pauluhn / @samchen7910
@daiyangyang945 I tested the PR with fullScreenCover and it was working as expected.