1

This article talks about how OS's accumulate all sorts of unnecessary things in the RAM due to continued use. Is this the case with Ubuntu too?

Just curious as my computer has been getting a bit sluggish after a week of not turning off.

SDG
  • 437
  • Just to add to this, I did restart my computer and it has made a ton of difference in the performance. – SDG Jun 15 '15 at 23:34

3 Answers3

3

Some applications, when working for days can "grow up" in memory because there might be memory leaks (memory is reserved and not returned when not needed). When you have less memory (because of memory leaks) system moves information from memory to disk (swap partitions) more often, and this is probably the reason of slowing down you experience.

3

You probably don't need to restart to clear the ram and swap, as you can clear both without restarting:

  • Clearing Swap: You can turn swap off and on again to clear it (make you have enough spare memory using free -m, top or similar) using sudo swapoff -a && sudo swapon -a. If stuff is moved to swap when you have enough free memory, and you don't want it to be, you need to configure swappiness.

  • Clearing Cache: Can be done by the method suggested here: free && sync && echo 3 > /proc/sys/vm/drop_caches && free. Needs to be done as root, so you can run sudo -i beforehand to drop into a root shell, or try enclosing it in sudo sh -c " "

  • Clearing programs from RAM: By closing open apps you don't need, and killing extra processes (CAREFULLY) in htop by selecting each process and pressing k+Enter (the tree view in htop is very useful here, press t to use it, then you can determine parent processes etc). Some applications (e.g KDE apps in a GNOME environment) start processes that you may not now need, so you can kill those

However, it may still be necessary to close the machine down every so often due to maintenance, memory leaks, overheating, power cuts etc. You also may need to restart to apply system updates (though you may not need to restart the system for kernel updates with kernel 4+),

Wilf
  • 30,194
  • 17
  • 108
  • 164
1

You can also open a terminal and do the following

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install bleachbit
sudo bleachbit

It will open a program that removes a lot of clutter, old kernels and it will give you a performance boost. Also a reboot every now and then is not bad :)

Brask
  • 1,588
  • 1
    This clears the system of crap, but doesn't necessarily affect RAM. Rebooting isn't bad either, however this answer doesn't really take an attempt to answer the true question being asked. – Thomas Ward Jun 15 '15 at 22:38
  • It answers it perfecly. I dont want to explain ram fragmentation so rebooting is good and clearing the crap also. Why dont you suggest something useful instead of me? – Brask Jun 15 '15 at 22:47
  • This is certainly relevant to the answer, but not the best answer as it does not address clutter in the RAM. But I feel like the downvote was a bit harsh (is this a topic for meta?). – SDG Jun 15 '15 at 23:30