Skip to content
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

[wayland]GIF image display, increasing memory, unable to free memory. #245

Closed
dazuo0312 opened this issue Dec 27, 2021 · 16 comments
Closed
Labels
memory leak Topics of memory leak wayland Topics of Wayland

Comments

@dazuo0312
Copy link

dazuo0312 commented Dec 27, 2021

Flutter -elinux runtime environment: ARM64, Debian, NXP iMX8
The interface runs to display GIF images, and the memory continues to increase, starting at 286M, 12 hours later, up to 900M.
flutter-elinux build elinux --release -d elinux-wayland
Here is sample code for the test.
hmi_ani

@dazuo0312 dazuo0312 changed the title GIF image display, increasing memory, unable to free memory. [wayland]GIF image display, increasing memory, unable to free memory. Dec 27, 2021
@nbhhcty
Copy link

nbhhcty commented Dec 30, 2021

I have the same problem

@suyulin
Copy link

suyulin commented Jan 4, 2022

free
It's not a wayland framework problem, flutter's 🐞。You can use frame animation to solve this problem。

@dazuo0312
Copy link
Author

dazuo0312 commented Jan 4, 2022

free
It's not a wayland framework problem, flutter's 🐞。You can use frame animation to solve this problem。
Can you provide a demo?
I use frame animation, but the problem still exists.
Animationcontroller is used.
Webp animation also has this problem.
The demo runs under elinux-x11 and there is no problem.
Only when running under Wayland can there be a problem.
It may be flutter-elinux's bug.
The following is a memory screenshot of the demo running under X11
eee1875081810296117
eee17731208499763
The following is a memory screenshot of the demo running under wayland
16270826251959
17071212404843

@suyulin
Copy link

suyulin commented Jan 5, 2022

Webp animation on Android , the memory is ok ?

@dazuo0312
Copy link
Author

Webp animation on Android , the memory is ok ?

yes

@suyulin
Copy link

suyulin commented Jan 5, 2022

Webp animation on Android , the memory is ok ?

yes

Flutter version is 2.5.2 ?

@dazuo0312
Copy link
Author

Webp animation on Android , the memory is ok ?

yes

Flutter version is 2.5.2 ?

Flutter version is :2.5.0 or 2.8.1.

@HidenoriMatsubayashi HidenoriMatsubayashi added the wayland Topics of Wayland label Jan 12, 2022
@renehansen
Copy link

We have the same problem, and in addition to the approaches already mentioned, we can confirm that Lottie and Flare cause memory leaks as well, which means that there is basically no way of doing animations at the moment.

Flutter version: 2.10.3

@HidenoriMatsubayashi
Copy link
Contributor

Unfortunately, I couldn't reproduce this issue using hmi_ani. I used x64 Linux host and Weston.

@dazuo0312
Copy link
Author

@HidenoriMatsubayashi I used ARM64, Debian, NXP iMX8.
There is this problem on the arm64 board.

@renehansen
Copy link

Yes, I am also experiencing the leak on arm64. Btw, here is the source code that contains a frame animation, as well as Lottie, and Flare animations

@HidenoriMatsubayashi
Copy link
Contributor

Can anyone use debugging tools like Valgrind to investigate the memory leak points?

@oz2mia
Copy link

oz2mia commented Apr 28, 2022

Using valgrind does not work, the program will not start correct.
I have tried using google/sanitizers that are build in the flutter engine, used LSAN and ASAN, but they only report heap used,
but not where the leak is.

@makotosato-at
Copy link
Contributor

Hello.
I was able to reproduce it on RPi4.
I think the problem will be improved with the following patch.

--- a/src/flutter/shell/platform/linux_embedded/window/elinux_window_wayland.cc
+++ b/src/flutter/shell/platform/linux_embedded/window/elinux_window_wayland.cc
@@ -233,6 +233,7 @@ const wp_presentation_feedback_listener
                 self->window_decorations_->Draw();
               }
 
+              wp_presentation_feedback_destroy(wp_presentation_feedback);
               wp_presentation_feedback_add_listener(
                   ::wp_presentation_feedback(self->wp_presentation_,
                                              self->native_window_->Surface()),
@@ -249,6 +250,7 @@ const wp_presentation_feedback_listener
                 self->window_decorations_->Draw();
               }
 
+              wp_presentation_feedback_destroy(wp_presentation_feedback);
               wp_presentation_feedback_add_listener(
                   ::wp_presentation_feedback(self->wp_presentation_,
                                              self->native_window_->Surface()),

@HidenoriMatsubayashi
Copy link
Contributor

I see. Thanks. Would it be possible for you to send the PR?

@HidenoriMatsubayashi
Copy link
Contributor

Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
memory leak Topics of memory leak wayland Topics of Wayland
Projects
None yet
Development

No branches or pull requests

7 participants