Page 3 of 6 FirstFirst 12345 ... LastLast
Results 21 to 30 of 53

Thread: HOWTO: Clear filesystem memory cache

  1. #21
    Join Date
    Jan 2010
    Beans
    2

    Talking Re: HOWTO: Clear filesystem memory cache

    Quote Originally Posted by crazy17 View Post
    Hi guys! This doesn't seem to work in 10.04. I get
    Code:
    bash: /proc/sys/vm/drop_caches: Permission denied
    I am not well versed in the terminal and have only been using linux for a couple of months now. I am using PAE with 6 gb of ram. Hope you guys can help. Oh, and the system monitor shows full memory cache use.

    I have the same issue with the vbox and hogging all of the memory, in 10.04 you need to be root using the SUDOERS privilege is not enough.

    sudo su
    then try the command to drop the cache
    echo 3 > /proc/sys/vm/drop_caches

    it worked for me.

  2. #22
    Join Date
    May 2010
    Beans
    1
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: HOWTO: Clear filesystem memory cache

    sudo echo 3 | sudo tee /proc/sys/vm/drop_caches

    this works ....

  3. #23
    Join Date
    Nov 2008
    Beans
    2

    Talking Re: HOWTO: Clear filesystem memory cache

    Just found this thread and command works great in 10.10 Maverick. Cache usage instantly dropped from 77% to 5% of 2Gb RAM.
    Thanks for the tip

  4. #24
    Join Date
    Sep 2008
    Beans
    13

    Re: HOWTO: Clear filesystem memory cache

    Thanks for the running as root suggestion!! (Works like a charm!)

    Here is a screenshot of my sysmonitor! (It monitors RAM, I have a memory problem, not enough!)
    Attached Images Attached Images

  5. #25
    psusi is offline Ubuntu addict and loving it
    Join Date
    Sep 2005
    Location
    Orlando, FL
    Beans
    3,980
    Distro
    Ubuntu Development Release

    Re: HOWTO: Clear filesystem memory cache

    Once again for those who didn't read the whole thread: clearing the cache is not a good thing. Caching files in memory that otherwise would be empty helps system performance. As soon as it is needed, it will be reallocated, but until then it may as well be put to good use.

    To put it another way, cache memory is, for all intents and purposes, free memory, with a bonus side effect.

  6. #26
    Join Date
    Oct 2008
    Beans
    4

    Re: HOWTO: Clear filesystem memory cache

    lol @ people upset that cache refills

    There are actually two things you can clear, and they're both read caches. Write caching is a different thing entirely, and is referred to as 'dirty memory'. 1 is file data (contents), 2 is file metadata(time, date, permissions, names, etc), and 3 is both. So for example, if you do a 'find /' looking for a file, and then read a 1GB file, and want to evict the 1 GB of data, but not lose the cached 'find' info, you can echo 1.

    man /proc and look for drop_caches for the exact details. None of this is Ubuntu specific, by the way.

  7. #27
    Join Date
    Nov 2009
    Location
    Canada
    Beans
    11
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: HOWTO: Clear filesystem memory cache

    I have ubuntu 9.10 server X86 setup with SMB shares as a headless media server in my basement network cabinet. It has been running 24/7 for about a year (with the exception of a few power outages from storms) and when it has been heavily used (in my case three computers streaming for a couple of hours) I notice that up to %30-47 of the memory will be cached (in this case checking from ssh remotely on network with no streaming occurring 20 minutes after peak activity). Streaming isn't negatively affected, but I will notice some "hesitation" when logging into the shares from a computer to browse to the file I wish to use after heavy multicomputer use of the shares. A reboot of the server clears the memory usage to normal (3% of 2 GB) and this is how I have dealt with it when it occurs.

    Thanks so much to the OP and suggestions of others. A quick login via ssh, dropping to root and

    Code:
    sync; echo 3 > /proc/sys/vm/drop_caches
    has made it much quicker to restore the snappiness of my samba media server without having to restart it remotely
    Last edited by waffletten; February 15th, 2011 at 04:06 AM.

  8. #28
    Join Date
    Dec 2010
    Beans
    3

    Re: HOWTO: Clear filesystem memory cache

    I just wanted to add my 2 cents.

    I woke up my laptop which I last night put to sleep and it had around 30% SWAP that's over 1GB.
    I have only 2GB of memory. Computer was 'useless' (meaning it felt like the old WinXP - almost there... almost there).

    I found Ubuntu clear swap info page and this page. I needed to clear my 1GB cache to fit swap back to ram. So after these two scripts I'm back in business! No restart needed.

    I don't know if there is another way to do this. But at the moment I have 40% free memory with no swap. Feels low amount considering I only run FireFox, scribes and gnome-term or whatever.

    I would really love to get some real info about memory usage in linux and ubuntu. Modern I mean. Since gwibber alone takes 25MB per each process coming to around 100MB all together !!!

    Really! 100MB for MSN
    UbuntuOne-sync also 30MB and nm-applet 30MB.
    But these are ALL extra programs and I can shut them down if need to so can't complain. They got great usability.

    But still would love to understand better about memory usage and need.

  9. #29
    psusi is offline Ubuntu addict and loving it
    Join Date
    Sep 2005
    Location
    Orlando, FL
    Beans
    3,980
    Distro
    Ubuntu Development Release

    Re: HOWTO: Clear filesystem memory cache

    Quote Originally Posted by the_jaykay View Post
    I woke up my laptop which I last night put to sleep and it had around 30% SWAP that's over 1GB.
    I have only 2GB of memory. Computer was 'useless' (meaning it felt like the old WinXP - almost there... almost there).
    Hibernation dumps all ram to swap so that it can be preserved without power. When you resume, most of it is only brought back to ram on demand, so things are slow while they keep having to wait to be swapped back in. I've not tried it myself, but I think I read that TuxOnIce fixes this by reading everything back in right away when you resume.

  10. #30
    Join Date
    Mar 2011
    Beans
    3

    Re: HOWTO: Clear filesystem memory cache

    Quote Originally Posted by crazy17 View Post
    Hi guys! This doesn't seem to work in 10.04. I get
    Code:
    bash: /proc/sys/vm/drop_caches: Permission denied
    I am not well versed in the terminal and have only been using linux for a couple of months now. I am using PAE with 6 gb of ram. Hope you guys can help. Oh, and the system monitor shows full memory cache use.
    You must become root by entering

    Code:
    # sudo -s
    Then putting in your password.

    Hope this helps
    The Unofficial

Page 3 of 6 FirstFirst 12345 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •