Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Thanks especially for using GTK with Rust to do this. We need to keep desktop Linux GUI libraries alive and viable (as an alterative to Web site GUI frameworks, Electron apps with Web frameworks, and proprietary mobile app platforms).




Though I was let down last week when I ported a TUI to GTK4 and found out that even a hello world gtk4.h C app uses 200mb RAM.

I haven’t tried it yet but I believe Qt will weigh around the same.

The TUI I ported uses <8mb RAM so I kinda lost interest in the GUI endeavor for my tools since I like to have one running in each project workspace.


> Though I was let down last week when I ported a TUI to GTK4 and found out that even a hello world gtk4.h C app uses 200mb RAM.

Bit of a rant I wanted to share here:

I've seen the same happened on zenity (a GUI dialog utility for shell scripts) since they migrated from GTK3 into GTK4.

Now zenity took almost 2 seconds to launch instead of .5 to a second when they still used GTK3.

This might be an issue on both libadwaita and GTK4 itself.

Both pavucontrol (which uses GTK4 but not libadwaita, at least for now) and even a simple dialog in zenity (GTK4+libadwaita) consumed over 100 MiB of memory according to btop measurement, while both thunar and engrampa, which is both GTK3 apps, only consumed half the amount of memory usage (about 50 MiB according to btop).

However, I've noticed that zenity, GNOME apps, and other apps that uses libadwaita took longer to launch compared to apps that only used GTK4 (pavucontrol), which launched as fast as other GTK3 apps does.


Hmm, maybe looking at btop memory usage is too naive.

I'm not very knowledgeable here, but apparently that includes the memory of libraries that other gtk4 apps would share.

If I launch 5x instances of my app and look at /proc/<pid>/smaps:

    | PID    | Private | PSS      |
    |--------|---------|----------|
    | 360955 | 65.4 MB | 133.0 MB |
    | 360956 | 52.1 MB | 105.0 MB |
    | 404303 | 65.8 MB | 132.9 MB |
    | 404304 | 65.8 MB | 133.2 MB |
    | 404305 | 65.9 MB | 132.6 MB |

Looks like PSS includes private memory + shared libraries divided by the processes using them, so a little better than the 200mb that btop shows, but still over 2x heavier than, say, a hello world on macOS.

Update: It turns out that in GTK4, half of the memory usage were dedicated to OpenGL hardware rendering alone.

Using GSK_RENDERER=cairo almost halved the memory usage of most GTK4 apps, but it doesn't fix the startup time.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: