13

I have 6GB RAM, i5 2.4GHZ Processor running Ubuntu 11.10. I partitioned my HD so that I have 8GB swap.

When streaming online or opening several tabs in Chromium I soon have 4GB Memory in the cache. And I think this makes my Notebook slow. When streaming a video, after a few minutes it really slows down and stumbles/jerks.

What could the problem be? How can I solve this?

P.S: initially I had 4GB and recently upgraded to 6GB, but I did not experience a significant change.

P.P.S: free -g in the terminal prints this:

               total       used       free     shared    buffers     cached
Mem:             5          2          3          0          0          0
-/+ buffers/cache:          1          4
Swap:            8          0          8
7
  • What do you mean by "RAM Cache" and how do you tell that it's getting full?
    – Sergey
    Nov 17, 2011 at 10:30
  • Can you please run free -g (in terminal) when you experience the problem and include the output of the command in your question. Nov 17, 2011 at 10:35
  • On my upper panel I have an applet that indicates RAM and CPU usage grafically. When I click it, it tells me that: "Mem: 2GB Cache 4GB"
    – Tobias
    Nov 17, 2011 at 17:13
  • 1
    free -g says you've 3GB of free RAM. Memory is not your problem!
    – ams
    Nov 17, 2011 at 19:59
  • Ok great thanks for clearing that up, but perhaps because in that moment I was not streaming online? I just had chromium running.
    – Tobias
    Nov 17, 2011 at 21:44

3 Answers 3

13

Caching data is RAM is supposed to make things faster, not slower - fetching things repeatedly from disk when you have unused memory is just silly. If you're spilling into swap space though, that will hit performance. You can easily tell if you're using any swap by running System Monitor. If the swap-space graph isn't climbing at the time the problem starts, then the problem isn't memory related.

Certainly, when you stream video it will get cached in memory, but it takes quite a lot of video to fill 6Gb! I'd expect it to take more than just a few minutes to download that much data, and much more to cause a problem!

Are you sure something else isn't the problem? Say, cooling perhaps? Many notebooks have processors that are overspeced compared to the cooling system. This is good - it gives high peak performance, good for bursty traffic, while keeping the bulk down - but it can't keep up the performance for long before it is forced to dial back the clock rate or melt. Video can be fairly processor intensive, so you never know?

Anyway, you should be able to see from the memory usage whether it's swapping or not. If it is, then that's a software problem, and those can be fixed. :)

4
  • I am using just 1,8% of SWAP. Cooling is not the problem as I have a cooling pad with two fans. I know video is processor intensive but i5 quad core 2,4GH and 6GB RAM should definitively be enough for smooth streaming.
    – Tobias
    Nov 17, 2011 at 17:14
  • 1.8% of swap suggests to me that your problem is not that you've run out of RAM. I agree, as long as your processor has not been throttled, it ought to be able to do the job.
    – ams
    Nov 17, 2011 at 19:57
  • Ok than perhaps it is the Browser itself?
    – Tobias
    Nov 17, 2011 at 21:44
  • Thanks for your answers I will try to use another browser and let you know if the issue persists. Thanks again, you were very helpful and kind, I really appreciate!
    – Tobias
    Nov 17, 2011 at 21:45
12

I've the same problem, it seems the cache is never released... One example was when I checked out a repository and end up with a cache of 4GB

Example:

$ free -m
             total       used       free     shared    buffers     cached
Mem:          7949       7425        523          0        112       4433
-/+ buffers/cache:       2879       5069
Swap:         7627          2       7625

What I did was to run the code bellow (the comments are just so you know what is going on), you may create a script so you can run it when you need it:

# To free pagecache:
#         echo 1 > /proc/sys/vm/drop_caches
# To free dentries and inodes:
#         echo 2 > /proc/sys/vm/drop_caches
# To free pagecache, dentries and inodes:
#         echo 3 > /proc/sys/vm/drop_caches
sudo sync && sudo sysctl -w vm.drop_caches=3

After I ran the code above:

$ free -m
             total       used       free     shared    buffers     cached
Mem:          7949       2820       5129          0          2        407
-/+ buffers/cache:       2409       5539
Swap:         7627          2       7625
6
  • 5
    This is not a problem, this is how the page cache works. It will keep things cached as long as possible, but release items automatically when memory pressure from other applications increases. Clearing it up manually is unnecessary.
    – Caesium
    Nov 22, 2011 at 16:08
  • 5
    It may be so but in that case the algorithm is not that good. Why would I've more than 4GB of cache and start to use swap?
    – Carlo
    Nov 23, 2011 at 8:29
  • On the subject, I like this article: link
    – Carlo
    Nov 23, 2011 at 8:30
  • 1
    In my current case I'm checking out a huge repository and all files are getting cached until it fills up the memory, once there it starts to swap instead of release cache...
    – Carlo
    Nov 23, 2011 at 8:33
  • I used to take an interest in kernel development .. Pretty sure this is still "by design." If the kernel thinks that part of a file is more likely to be accessed again soon than some anonymous data, it would swap the anon data and keep the page cache. Whether it's making the right decision is a different question, of course :)
    – Steve Dee
    Feb 6, 2014 at 22:36
0

My suggestion would be to run any process explorer (System Monitor for example) and check what is the process consuming so much memory. post it here and we'll see if you can turn it off.

ps. ok, I get it now. I bet its 'plugin container' that grows with time due to the way it uses memory. I guess its because its a port from Gill Bates system;). Killing it wont help (by killing it you'll crash all animations on each page, mainly ads but also Youtube videos). Also, Chromium itself loves to bloat with time so the only way to deal with it would be probably to restart it from time to time. See if it helps...

4
  • Indeed, when I restart the browser, the streaming runs smoothly again, however just for 10minutes. Then I have to restart the browser again.
    – Tobias
    Nov 17, 2011 at 17:17
  • The Processes used: Chromium 250MB Chromium 214 MB Chromium 150Mb, compiz 119 MB, zeitgeist-daemon 111 MB, chromium 70Mb, exe 24% of CPU and 60MB, Rhythmbox 50MB, ubuntuone-syndaemon 26MB etc..
    – Tobias
    Nov 17, 2011 at 17:22
  • Im afraid your problem may be caused by the browser itself. Consider switching to Firefox or any of your choice, users opinion over the web says Chromium consumes about 3x more memory than any other 'top line' browser. Give it a try. Install, open the same number of tabs and compare... Nov 17, 2011 at 23:37
  • I'll dp that. Thanks very much for the suggestion. all the best
    – Tobias
    Nov 18, 2011 at 9:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .