7

I am experiencing a pretty huge memory leak from gnome-shell and after a while memory is up to over 5GB. I have 8GB of system memory and when the system starts using swap the whole system slows down a lot. I do have a SSD but that doesn't make matters better. I have changed the swap settings to 1 but that has no effect. I regularly kill gnome-shell off to be able to use the system. I came from Unity where system-ram was used quite heavily and swap was sometimes used as well. My solution was to up ram from 4GB to 8GB and to change to GNOME, but it seems I still have the same problem :-(

Any ideas how to limit gnome-shell ram usage? Any program that can kill off gnome when it exceeds 4GB for example? I don't really know what to do except try Unity again or change to Xubuntu or such. I do really like GNOME though...

Zanna
  • 72,471
  • A have a couple of scripts which clear the cache, and push swap back onto disk. If you would like to try them I can post them into an answer. – Charles Green Dec 05 '14 at 18:13
  • Please post more information on your memory use. output of free -m. top can also help. Linux is not windows and unused RAM is wasted RAM. Hard to know if you even have a problem. Clearing the cache and pushing swap back to disk may or may not help. – Panther Dec 05 '14 at 19:49
  • here is my free -m output: total used free shared buffers cached Mem: 7967 7555 412 43 33 2739 -/+ buffers/cache: 4781 3185 Swap: 3813 588 3225 – plausibly107 Dec 05 '14 at 22:03
  • I prefer the system not to use swap completely as it uses the ssd to much and it only makes the system slower. It is a bit annoying that it is so hard to stop the system from using it. I do want to be able to put the computer to sleep :-) – plausibly107 Dec 05 '14 at 22:06
  • For the close voters: I think that this is fully in topic with the Gnome flavor of Ubuntu. – Rmano Dec 05 '14 at 22:40
  • This is still relevant. Gnome shell leaks memory, in current LTS also, often due to some (badly written) extension. So I think it's worth keeping this open. – Rmano Apr 26 '17 at 08:21
  • It's still a bug, no? Although it appears it doesn't happen when using intel video drivers... Perhaps this is only an NVIDIA issue? – Elder Geek Apr 26 '17 at 16:22

1 Answers1

7

gnome-shell leaks memory like a colander.

There is a bug reported here (it's for Mint but it's the same problem) and on redhat.

Upstream there are at least 9 bugs reported.

Basically (one developer told me once, I can't find the reference) gnome-shell is completely unable (by design) to control the memory usage of its extensions. Add this to the fact that there is no API documentation for writing them (at least, I could not find it when I wrote mine) and well... leak happens.

In my case, I had to remove a couple of extensions (sensors and weather were the main culprits) that made the shell grows like crazy. Even now, every now and then I have to restart the shell with Alt-F2 and r to get it back to its normal size (and then you have to cope with gnome-terminals going crazy...).

Practical solution:

  1. remove all extensions, look at the memory usage, and add them one by one to find the worst offender(s).

  2. gnome-shell still leaks memory by itself, or you really need some extensions. So I do every now and then (basically every morning, my PC is normally on 24/7):

  3. kill gnome terminals to avoid the bug above (in 14.04-shell 3.10; should be fixed in newer shell), by doing from one of them:

    killall gnome-terminal 
    

    and reset the shell with Alt-F2 and r

PD: I know, there are others DEs. But I like gnome-shell, call me crazy...

Rmano
  • 32,217
  • I might need to take away an extension. I tried a extension that monitors temperature but i didnt get it to work anyways...I would be great if it were that simple!

    I really like the simplicity of gnome instead of unity :-P

    – plausibly107 Dec 05 '14 at 22:07
  • i unistalled a few gnome programs to lessen the memory, now it is only up to 3gb. I will see tomorrow if it helped. I also disabled the firefox-ubuntu-addon inside firefox. I hope this helps :-) – plausibly107 Dec 05 '14 at 22:44
  • didnt seem to work....3.6gb and climbing :-( – plausibly107 Dec 05 '14 at 22:49
  • Up to 6.1gb now....This does not feel normal. It is a very fresh install with very little tinkering done to the system. – plausibly107 Dec 06 '14 at 08:03
  • Try to remove all extensions and repeat. If still there, it is probably something introduced in 14.10 --- so a bug report would be the right way. I have no intention to upgrade now... I have work to do ;-) – Rmano Dec 06 '14 at 08:48
  • It seems that the removal of extensions seemed to work after i rebooted :-) Now it is stable on 2.3gb. Thanks for the help!!!! – plausibly107 Dec 06 '14 at 21:14
  • Yep. This is the same for me. It would be nice to build a list of "safe" extensions... if you think the question is answered, please mark it so. http://askubuntu.com/help/someone-answers – Rmano Dec 06 '14 at 21:17
  • Note to @korc about your suggested script to automate this (in edit): restarting the shell and killing the terminals can be disruptive of what you're doing, and cause data loss if done at the wrong time. So I think it's basically a manual thing... – Rmano Aug 10 '15 at 10:45
  • On Ubuntu 16.04.2, $ killall gnome-terminal' gives gnome-terminal: no process found`. Memory usage is increasing rapidly. Any update? – Xiaodong Qi Apr 26 '17 at 05:14
  • @XiaodongQi, if you have no terminals running, simply skip the step. The trick here is to find which extension (if any) is creating the leak. Use gnome-tweak-tool to see which extensions are loaded, and explore from there. In my 16.04.2 gnome-shell is quite usable, barring the sporadic crash-and-restart. – Rmano Apr 26 '17 at 08:23