linebender / druid

A data-first Rust-native UI design toolkit.
https://linebender.org/druid/
Apache License 2.0
9.53k stars 569 forks source link

Memory leak on macOS #793

Open totsteps opened 4 years ago

totsteps commented 4 years ago

As per discussion on zulip chat, I was experimenting with druid and wrote the simplest example which shows just one label.

For this simple example, memory usage is ~5x on macOS as compared to Linux when the window has minimum width and height. And around ~12x when a window is in full screen.

Profiling the binary built with release mode for alloc & leaks, Instruments shows 6 memory leaks!

PoignardAzur commented 3 years ago

Does this still happen on the latest version?

totsteps commented 3 years ago

Yes, this still happens on the latest changes.

Screenshot 2021-08-05 at 23 44 45

melody-notpond commented 3 years ago

I'd like to note that, on my Linux computer, the same example takes ~737 megabytes, which is a significant amount. A GUI framework should not be using 700 megabytes just for a single label in a window. I think there are memory leaks on Linux as well.

Here is the code I used:

use druid::{AppLauncher, WindowDesc, widget::Label};

fn main() {
    AppLauncher::with_window(WindowDesc::new(Label::new("uwu"))).launch(()).unwrap();
}

I am using the git version.