-
Notifications
You must be signed in to change notification settings - Fork 789
Description
Bug Description
Hello,
I've noticed an apparent memory leak.
The system it happens on is running Kubuntu 24.04 and X11. It occurs with the qt backend (Qt5). Setting SLINT_BACKEND to winit-skia prevents it from happening.
The code that produces the memory leak is as follows:
- a slint
Timercomponent is running - the timer's value is displayed in a Text component
- an embedded image is used as an icon for the window.
The memory leak takes the form of KDE Plasma's plasmashell process' RAM usage monotonically increasing. This leaks occurs only when the three conditions above hold true. An image embedded in an Image {} element does not cause a leak. If the timer is stopped, the increase also stops. After the app is shut down, plasmashell's RAM usage does not go down.
I'm providing a minimal code to reproduce. For it to run, you'd have to include a github-logo.png in the ui directory to serve as an icon.
app-window.slint
export component AppWindow inherits Window {
property <int> global-time-value: 0;
icon: @image-url("github-logo.png"); // <- commenting out prevents leak
global_timer := Timer {
interval: 10ms;
running: false;
triggered() => {
global-time-value += 1;
}
}
VerticalBox {
Text {
text: root.global_time_value; // <- replacing with static text prevents leak
horizontal-alignment: right;
}
Image {
source: @image-url("github-logo.png"); // <- does not cause a memory leak
}
Button {
text: "Start";
clicked => {
global_timer.start();
}
}
Button {
text: "Stop";
clicked => {
global_timer.stop();
}
}
}
}main.rs
use std::error::Error;
slint::include_modules!();
fn main() -> Result<(), Box<dyn Error>> {
let ui = AppWindow::new()?;
ui.run()?;
Ok(())
}Reproducible Code (if applicable)
Environment Details
- Slint Version: 1.12.1
- Platform/OS: Kubuntu 24.04, X11
- Programming Language: Rust
- Backend/Renderer: Qt5
Product Impact
No response