Closed GabrielAraujo closed 1 year ago
Thank you for this great analyze. We will investigate further to reproduce and see what we can do.
@g-apparence Thank you! I've also tested under the example project on this repo and the same happens.. So it is def something related to how we display the camera preview on the native side.
Let me know if you need any help!
@GabrielAraujo nice find!
Checked on Android
Seems ok
Going to try reproducing on some iOS phones now. I'll let you know
@g-apparence Thank you! I've also tested under the example project on this repo and the same happens.. So it is def something related to how we display the camera preview on the native side.
Let me know if you need any help!
Seems related yes... This seems like a big flutter issue that should get more attention
I've tested using the Camera from the Image picker package and the same does not happen.. Could it be something this package is not properly handling/disposing? Due to the not released mem size it feels like it is some kind of image buffer that is not properly released..
Do you have any next steps in mind or are you planning on waiting for the flutter side?
@g-apparence is there a specific Flutter issue on Github that you're referencing?
From the initial message
I've some ideas, but I have to discuss first with our iOS expert as I'm not comfortable with ObjC.
I can't reproduce this on an Iphone X / iOS 16.3.
Maybe that's related to pre iOS 16 and textures. I've added an unregister texture before closing the videoon iOS, but I cannot garantee that's going to fix your bug.
What is your flutter version? (I've stayed on the previous flutter version). I've used the version 3.3.10 and also the 3.7.0 both with the same problems
what is the camerAwesome version you used? I've tested with the 0.3.3 version and also with the 1.2.0, both showed the same results
Did you run this test in profile mode? Yes, I've also tested on my iphone 13 Pro on profile with iOS 16 and it also occurs
Even seems to be a bit worst and the memory don't return to a lower level at all.
Here is the gist on the changes I did on main.dart
for the example project so we could simulate closing/reopening the camera. (Could also be something on the way I've implemented it too)
The good news is that on the Fix you worked on it seems to solve the issue:
Here is the mem profile after opening/closing the camera multiple times on the fix/ios_unregister_texture branch
Ahh great.
I think it's related on the fact that you are using a constant Key on the camera page. Flutter tries to recreate the same widget without the texture properly disposed. Just out of curiosity, I'll try to see if that's right.
I close this as it seems fixed. Thank you for your help fixing this. 🙏🏻
Thank you for fixing this! Do you have an idea when this will be released as an official version increment to the package?
Steps to Reproduce
If you keep displaying and closing the camera multiple times it will increase the RAM usage to a point where the app crashes due to OOM.![Screen Shot 2023-02-06 at 11 00 58](https://user-images.githubusercontent.com/7611463/216991155-df42e9ca-049a-404a-a8e0-a7a417ec1083.png)
As you can see in the image the spike is when you open the camera and when it drops upon closing it never comes back to the previous level of mem usage. And it is because of some memory retain that is happening on the call tree bellow![Screen Shot 2023-02-06 at 11 02 29](https://user-images.githubusercontent.com/7611463/216991517-e00267d4-25f6-4005-8224-05aee2ab901b.png)
I've found this thread but I don't know if it relates to how the plugin was implemented.
Due to the nature of our app, the users open and close the camera quite a lot and OOM issues is the main cause of crashes for us right now.
Expected results
App running smoothly
Actual results
App crashing
About your device