-
-
Notifications
You must be signed in to change notification settings - Fork 172
Strange case 'Out of memory' #133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I did some debugging (which was actually a bit time consuming tbh). If you look up the explanation to what To find out what is using memory in the flutter-pi process, you can The issue seems to be the call to There's a warning about this in the documentation to
It's also important to note that while the image files themselves are only 20kB, they are heavily compressed jpegs. When they're stored in GPU memory as textures, they are uncompressed and take up about 16MiB (= 2560px * 1600px * 4 bytes per pixel) each. |
yes, I did such research too. so i call 'imageCache.clear()' ( https://github.com/DisDis/flutter-pi-oom/blob/master/lib/main.dart#L116 ). But the memory is not returned :(. |
You're right, i missed that. You even added some debug output in the app that lists the live image count, I missed that too. Actually I added some logging to Interestingly, the depth effect seems to be creating and deleting a lot of textures. Maybe something in the driver is leaking memory there? Maybe upgrading to latest mesa3d will bring a difference, the default mesa on raspberry pi is quite old. |
@ardera Is there some branch with log? |
Just pushed it, the branch is called
True, it's less likely. Memory leaks in mesa aren't that uncommon though, if you look at the release notes. Also, mesa has inbuilt support for valgrind for debugging memory leaks, which also seems to hint that memory leaks aren't that uncommon. |
Just ran flutter-pi with the logging. According to the driver logging, the number of buffer objects allocated, and the size of the BOs combined grows steadily. I think with some additional logging it should be possible to find out what BOs aren't freed |
Was entirely my fault. Forgot to restore some OpenGL state after presenting. Then, when flutter tried to delete some textures after my present function was called, there was no OpenGL context bound and the textures weren't deleted, causing the OOM. It's fixed now |
thanks, a lot of work has been done. |
I created special repo for reproduce: https://github.com/DisDis/flutter-pi-oom
Host:
RaPi:
This application does not consume memory directly.





However, the 'buff/cache'(in TOP command) is leaking gradually.
Init: 761mb 'buff/cache'
After 1min: 1339mb
after 3min: 2195mb
after 5min: 3048mb
after 8min: 3400mb
System slows down

after KILL process: buff/cache free
MySystem : RaPi4 (4Gb)
i tried on kernel:
and
the result is the same.
I noticed that memory leak happens after somes effects 'DepthEffect, ForegroundToBackgroundEffect...' ( see https://github.com/DisDis/flutter-pi-oom/blob/master/lib/effects.dart#L18 and https://github.com/DisDis/flutter-pi-oom/blob/master/lib/main.dart#L85 )
The text was updated successfully, but these errors were encountered: