2

I have a problem that I'm trying to solve for a long time. I'm using Ubuntu 16.04 dual boot with Windows 10:

When I'm using several tabs in Firefox or Chromium, I see significant memory usage. One tab takes up to 500MB of RAM and when it gets to 3,7GB Ram usage my pc freeze and only what I can do is hard-reset my pc.

I've tried several things to solve this problem:

  • Disabled all add-ons in Firefox (Firefox version is 58)
  • Update kernel to 4.13
  • Disabled "Use hardware acceleration when available" and made more thing to optimize Firefox performance
  • Tried to use Firefox in safe mode
  • Increased swapping vm.swappiness=10 and swap to 8gb

I have a total 4GB of RAM. I never had that problem using Windows before only this happens on Ubuntu.

free --human output:

              total        used        free      shared  buff/cache   available
Mem:           3,7G        1,2G        1,2G         50M        1,3G        2,2G
Swap:          8,1G          0B        8,1G

swapon output

Filename            Type        Size     Used   Priority
/swapfile           file        8388604     0         -1
/dev/sda5           partition   102396      0         -2

uname -r output

4.13.0-32-generic

What else can I try to solve the problem?

Fabby
  • 34,259
Viktor
  • 151
  • Add swap space. Read man mkswap;man swapon. – waltinator Feb 09 '18 at 16:19
  • 1
    that's not a solution for me, 4 tabs opened is not a lot + IDE is opened and nothing more – Viktor Feb 09 '18 at 16:20
  • "I see significant memory usage" is kind of vague, can you post any evidence. Also, which precesses use RAM the most? – mikewhatever Feb 09 '18 at 16:27
  • @mikewhatever Firefox tabs using the most memory it showing that one tab taking up to 400MB – Viktor Feb 09 '18 at 16:29
  • Have you ascertained that your hardware is in good working order and that the kernel you are using isn't the problem? Please [edit] the output of uname -r into your post. thank you for helping us help you! – Elder Geek Feb 10 '18 at 19:20
  • Could you please [edit] your question to include the output of free -h and swapon -s? Thanks. – David Foerster Feb 11 '18 at 10:59
  • 1
    i edited the question with the output of free-h and swapon -s – Viktor Feb 11 '18 at 17:34
  • Although this link is about google chrome eating up all the RAM, your firefox problem seems similar: https://askubuntu.com/questions/817966/google-chrome-will-take-up-my-memory-to-the-point-where-it-causes-my-computer-to/817995#817995 – WinEunuuchs2Unix Feb 11 '18 at 18:39
  • From the free output, it looks like you have 256 MB assigned to video, and 2.2 GB available for use. If you have 4 tabs at 400 MB each, then you would still have ~600 MB available. A few more tabs would put you into swap. It would be extremely slow, at that point, but likely not entirely frozen, depending on what gets swapped. You may want to switch to a lighter environment too, or to disable/remove other optional features in the system which you don't need. – dobey Feb 12 '18 at 16:35
  • @dobey one tab can take more than 500MB and if I will open something else for example code editor, pc will freeze. I already disabled many thing in Firefox it didn't help – Viktor Feb 12 '18 at 17:16
  • If that's the output of your memory while 4 Tabs are open, each open tab can't occupy 400MB. It would be 300MB if the kernel and X11 and all that stuff wouldn't use anything. Probably, your information includes memory, which is needed by each tab, but shared between them. You might open 4 tabs, measure, open a 5th and measure again, using free to control the total amount. – user unknown Feb 18 '18 at 00:59
  • Any feed-back on below answer? – Fabby Mar 18 '18 at 11:42

1 Answers1

-1

What you're running into is called swapping: You're out of RAM and the kernel swaps unused programs to disk. Setting swappiness to 10 just means the kernel is swapping later rather than earlier (as the default is 60).

As swapping to disk is 1000 times slower than using RAM it just looks like your PC is freezing, but it's not.

You have a few options:

  • Don't use Chromium: that's a real memory hog; stick to Firefox only!
  • Use AdBlock+ (advertisements eat memory too)
  • Use NoScript (only allow the scripts you need on the pages you need)
  • Use fewer tabs
  • set swappiness back to 60 and be patient when swapping

and the easiest solution of all:

  • Buy more RAM

(also the most expensive)

Fabby
  • 34,259