WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: empty the cache  (Read 3881 times)

Offline vinnie

  • Hero Member
  • *****
  • Posts: 1187
  • HandMace informatic works
empty the cache
« on: November 30, 2009, 08:57:38 AM »
What is the command to clear the cache?
On this PC I have 2gb but after a few days of use (and no further installation) the memory is saturated.

Code: [Select]
tc@box:~$ free
              total         used         free       shared      buffers
Mem:        2073984      1934264       139720            0            0
Swap:            0            0            0
Total:      2073984      1934264       139720

I believe that free is not true, in fact watching the cache parameter of this other command:
Code: [Select]
tc@box:~$ cat /proc/meminfo
MemTotal:        2073984 kB
MemFree:          140632 kB
Buffers:               0 kB
Cached:          1774592 kB
SwapCached:            0 kB
Active:          1270808 kB
Inactive:         625756 kB
Active(anon):    1270808 kB
Inactive(anon):   625756 kB
Active(file):          0 kB
Inactive(file):        0 kB
Unevictable:           4 kB
Mlocked:               4 kB
HighTotal:       1186312 kB
HighFree:          56544 kB
LowTotal:         887672 kB
LowFree:           84088 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:        121976 kB
Mapped:            35604 kB
Slab:              20868 kB
SReclaimable:       7296 kB
SUnreclaim:        13572 kB
PageTables:          780 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     1036992 kB
Committed_AS:    2065816 kB
VmallocTotal:     122880 kB
VmallocUsed:        1344 kB
VmallocChunk:     120708 kB
DirectMap4k:        8184 kB
DirectMap4M:      901120 kB

Offline Jason W

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 9730
Re: empty the cache
« Reply #1 on: November 30, 2009, 09:23:58 AM »
echo 3 > /proc/sys/vm/drop_caches

Offline vinnie

  • Hero Member
  • *****
  • Posts: 1187
  • HandMace informatic works
Re: empty the cache
« Reply #2 on: November 30, 2009, 09:32:57 AM »
I must correct, the phenomenon is much more limited than what I did seem.
I delete a bit of stuff.
Code: [Select]
root@box:~# free
              total         used         free       shared      buffers
  Mem:      2073984       903084      1170900            0            0
 Swap:            0            0            0
Total:      2073984       903084      1170900

The space occupied by all directory (except /sys and /proc) is 700 mb, 900-700=200mb.
This 200 mb where they will?

@jason, the commando echo 3... not sort any result.

Offline Jason W

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 9730
Re: empty the cache
« Reply #3 on: November 30, 2009, 10:28:49 AM »
echo 3 > /proc/sys/vm/drop_caches  clears pagecache, dentries, and inodes. 

The 200mb you have unaccounted for is probably mounted extensions.  The 4096 block size save a bit of ram over the 128kb block size, but depending on how many files are in each mounted extension, there is still ram taken up when extensions are mounted and the files in each extension are read to be symlinked.

Offline Jason W

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 9730
Re: empty the cache
« Reply #4 on: November 30, 2009, 03:29:37 PM »
I left out one important detail.  Use the "sync" command before flushing the cache.

Offline jls

  • Hero Member
  • *****
  • Posts: 2135
Re: empty the cache
« Reply #5 on: December 01, 2009, 05:58:56 AM »
u know everything jason, I only don't understand what's funny in playing farmville.
I never tried
dCore user

Offline Jason W

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 9730
Re: empty the cache
« Reply #6 on: December 01, 2009, 08:45:47 AM »
Great, now everyone will think that I am playing games instead of uploading their extensions.   :)  Just kidding.  My crops keep dying on me anyway, I don't spend the time with it that it seems to require to keep on top of it.

Actually, it is not that I know much, but I have learned how to find information or solutions.   The first seach result of "linux empty cache" in a google had the above mentioned command.  

Offline vinnie

  • Hero Member
  • *****
  • Posts: 1187
  • HandMace informatic works
Re: empty the cache
« Reply #7 on: December 02, 2009, 11:21:58 AM »
The command sync+echo3 work only for "buffer and cache" displayed with "free"
However my program are all installed in ram :)

Offline Jason W

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 9730
Re: empty the cache
« Reply #8 on: December 02, 2009, 11:43:24 AM »
If the programs are loaded to ram, then that explains the ram usage.

Offline jpeters

  • Restricted
  • Hero Member
  • *****
  • Posts: 1017
Re: empty the cache
« Reply #9 on: December 02, 2009, 12:01:58 PM »
You might try loading only what you need with symlinked groups. (See load-grp script). Here's what I'm presently using. If I need something from tce_dir, "load ext" loads it in under a second.


Mem: 211336K used, 303948K free, 0K shrd, 19496K buff, 113776K cached


http://forum.tinycorelinux.net/index.php?topic=3404.0


Offline vinnie

  • Hero Member
  • *****
  • Posts: 1187
  • HandMace informatic works
Re: empty the cache
« Reply #10 on: December 02, 2009, 12:38:18 PM »
Ok, thanks jason and to all :)
Now everythings is crearer