slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
17.55k stars 601 forks source link

The memory of the pager cannot be released #3520

Closed weilai2918 closed 9 months ago

weilai2918 commented 1 year ago

I read the list to the page, and every time I render the page, the memory will increase. After clearing the list, the memory will not be released. The next time I add the list again, the memory will also increase. This is my code:https://github.com/quiet-feifei/feifei-tools.git

Another issue is that the drop-down box may not display completely at the bottom

Thank you for your answer

hunger commented 1 year ago

Sorry, I noticed your report only just now. I pinged the people that know this code better than I do.

ogoffart commented 1 year ago

I ran your program through heaptrack.
(I had to apply this diff to get it compiled)

diff --git a/src/system/mod.rs b/src/system/mod.rs
index b6e9e34..c0d3dc5 100644
--- a/src/system/mod.rs
+++ b/src/system/mod.rs
@@ -50,8 +50,7 @@ pub fn run_main(main: Main){
     //let _ = tray_menu.append(&theme_tray_menu);
     let _ = tray_menu.append(&show);
     let _ = tray_menu.append(&quit);
-    
-    
+    let _w = main.as_weak();
     #[cfg(target_os = "linux")]
     std::thread::spawn(|| {
         use tray_icon::menu::Menu;
@@ -67,7 +66,7 @@ pub fn run_main(main: Main){

         _tray_icon.set_title(Some("title"));

-        show_tray_menu(main.as_weak());
+        show_tray_menu(_w);
     });

     #[cfg(not(target_os = "linux"))]

I went clicked through the page on the left many times. I assumed this is what you meant. And I do not see the memory increasing

This is how it looks:

image

I'm not sure exactly what memory cannot be released?
What exactly do you need to do in the app to observe the problem? What backend are you using?

Another issue is that the drop-down box may not display completely at the bottom

That's https://github.com/slint-ui/slint/issues/2375

ogoffart commented 9 months ago

Closing since no further information was provided