Unexpected memory allocation
Closed this issue · 0 comments
Memory usage of Rust programs compiled with Slint seems unexpected:
- Memory does not seem to be freed after dropping all Slint related objects
- using QT as a back end, initial memory usage is high even before creating any windows
Example
A program running in the background for a while, then creating a window and eventually closing again.
I made a minimal repo based on the Slint template to reproduce the issue ( https://github.com/PsycHead/slint-memory-test ).
Expected Behavior
- The program starts with a fairly low memory footprint (the executable)
- As the Window is drawn, more memory is allocated
- After dropping all Slint objects, the allocated memory is released
Current Behavior
RAM usage on my system (Arch Linux, Wayland) for all three program phases. (Phase - QT - Winit)
- Startup, no UI - 70MB - 2MB
- UI visible - 102MB - 167MB
- UI droppend - 107MB - 167MB
Note that memory is not freed after dropping the UI and that QT immediately increases the memory footprint by a lot.
Why is this an Issue?
My use case is a service that will run in the background and wait for a signal to occasionally show an interactive window. Consuming more than 100MB for a dormant program is not acceptable in that case.
Discussions #5854 and #3376 may be related. Adding SLINT_DESTROY_WINDOW_ON_HIDE=1
does nothing on my machine.