sony / flutter-embedded-linux

Embedded Linux embedding for Flutter
BSD 3-Clause "New" or "Revised" License
1.21k stars 128 forks source link

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

Closed dazuo0312 closed 11 months ago

dazuo0312 commented 2 years ago

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

nbhhcty commented 2 years ago

I have the same problem

suyulin commented 2 years ago

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

dazuo0312 commented 2 years ago

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 commented 2 years ago

Webp animation on Android , the memory is ok ?

dazuo0312 commented 2 years ago

Webp animation on Android , the memory is ok ?

yes

suyulin commented 2 years ago

Webp animation on Android , the memory is ok ?

yes

Flutter version is 2.5.2 ?

dazuo0312 commented 2 years ago

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.

renehansen commented 2 years ago

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 commented 2 years ago

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

dazuo0312 commented 2 years ago

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

renehansen commented 2 years ago

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 commented 2 years ago

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

oz2mia commented 2 years ago

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 commented 11 months ago

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 commented 11 months ago

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

HidenoriMatsubayashi commented 11 months ago

Closing.