Score:0

gnome-shell consumes several GB of RAM

ru flag

I am using Ubuntu 20.04 (Linux 5.8.0-48-generic #54~20.04.1-Ubuntu) and today I find that gnome-shell is using LOTS OF RAM

        USER      PR  NI    VIRT    RES    SHR    %CPU  %MEM     TIME+ COMMAND                                    
   2365 gdm       20   0   14.7g  11.0g  10.8g S   0.0  35.1 143:54.82 gnome-shell                                
  76510 youran    20   0 8937064   3.2g   3.0g S   0.0  10.2 123:57.14 gnome-shell

This server has 32GB of RAM but 21GB is used even there is no workload.

            total        used        free      shared  buff/cache   available
Mem:        31Gi        21Gi       2.5Gi       1.8Gi       6.7Gi       7.1Gi

Notice that this server has been up for 123 days,

$ uptime
 13:08:18 up 123 days, 22:54,  4 users,  load average: 0.79, 1.19, 1.00

so I think there is some memory leak. I know a fresh restart can solve this problem. However, I want to know why, because Linux user should not always restart their computer. My gnome version is

$ gnome-shell --version
GNOME Shell 3.36.7

Related Questions:

cn flag
Comments are not for extended discussion; this conversation has been [moved to chat](https://chat.stackexchange.com/rooms/131200/discussion-on-question-by-youran-gnome-shell-consumes-several-gb-of-ram).
heynnema avatar
ru flag
Status please...
Youran avatar
ru flag
So I finally compromised and restarted GUI.
Youran avatar
ru flag
Sorry, this question's topic is asking WHY the GUI is taking so much RAM, or at least how to check why. "`I know a fresh restart can solve this problem. However, I want to know why.`" However, I appreciate your answer, and your answer may be helpful for other users.
guiverc avatar
cn flag
Your pastes show a system that is very behind on security patches so do you maintain your system? You're using 20.04.2 based on your paste; a fully *upgraded* system will report as 20.04.3, so what else have you held back that have caused security upgrades to not be applied?
heynnema avatar
ru flag
@Youran The WHY is because there's a bug in gnome-shell. Says so in the first line of my answer. The devs have been having a very hard time trying to figure out the bug and the fix.
NovHak avatar
cn flag
@Youran I note the process taking up the most RAM by far is the login session gnome shell (the one owned by gdm), but I see you're already logged in, hence that session shouldn't be existing unless you switched to virtual console 1 at some point. Killing that shell will probably be enough to close it, and should you need to invoke it again, just switch to VC 1 and it will respawn.
Youran avatar
ru flag
@NovHak Yes, this is the situation. I logged in a long time ago and forgot to quit. The session exist from that time on. I now know that, as long as I remember to log out, it will not show increasing RAM usage.
NovHak avatar
cn flag
I wasn't speaking about your user X session, rather about the gdm login session (the login screen if you prefer) : it's still active despite you're already logged in, and it's precisely its gnome-shell process that has the biggest resident set size (11 GB). Killing that process alone would free much memory, without having to close your user session.
Youran avatar
ru flag
Thank you. I will keep an eye on this point.
Score:2
ru flag

Memory leaks are a known problem (bug) of gnome-shell.

Three workarounds...

  1. Use Wayland instead of X11/xorg. (Change on your login screen).

  2. In X11/xorg, restart gnome-shell with ALT+F2, then "r", then ENTER.

  3. Update to a newer version of Ubuntu.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.