You are not logged in.

#1 2009-04-14 14:27:43

securitybreach
Member
From: In front of my computers
Registered: 2007-11-18
Posts: 416
Website

High memory cache?

I have 6gb of ram and I was wondering why Linux caches so much of my ram.

[comhack@Venus ~]$ cat /proc/meminfo
   MemTotal:        6106320 kB
   MemFree:           36448 kB
   Buffers:           26820 kB
   Cached:          5240552 kB
   SwapCached:        22612 kB
   Active:          2386232 kB
   Inactive:        3461080 kB
   Active(anon):     432208 kB
   Inactive(anon):   150216 kB
   Active(file):    1954024 kB
   Inactive(file):  3310864 kB
   Unevictable:        1888 kB
   Mlocked:               0 kB
   SwapTotal:       3903784 kB
   SwapFree:        3852648 kB
   Dirty:                52 kB
   Writeback:             0 kB
   AnonPages:        570728 kB
   Mapped:            33604 kB
   Slab:             174628 kB
   SReclaimable:     166724 kB
   SUnreclaim:         7904 kB
   PageTables:         7396 kB
   NFS_Unstable:          0 kB
   Bounce:                0 kB
   WritebackTmp:          0 kB
   CommitLimit:     6956944 kB
   Committed_AS:     894396 kB
   VmallocTotal:   34359738367 kB
   VmallocUsed:      311880 kB
   VmallocChunk:   34359417339 kB
   DirectMap4k:      956032 kB
   DirectMap2M:     5335040 kB
[comhack@Venus ~]$ free -t -m
                total       used       free     shared    buffers     cached
   Mem:          5963       5921         41          0         27       5095
   -/+ buffers/cache:        798       5164
   Swap:         3812         47       3764
   Total:        9775       5968       3806

Nothing is using the memory either:

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
   comhack   2943  0.0  0.0  17436  1336 tty1     S    01:46   0:00 -bash
   comhack   2947  0.0  0.0  15200  1200 tty1     S+   01:46   0:00 /bin/sh /usr/bin/startx
   comhack   2963  0.0  0.0  14420   744 tty1     S+   01:46   0:00 xinit /home/comhack/.xinitrc -- /etc/X11/xinit/xserverrc :0 -a
   comhack   2978  0.0  0.0  81036  5752 tty1     S    01:46   0:00 /usr/bin/openbox
   comhack   2979  0.0  0.0  45832  1776 tty1     S    01:46   0:00 xscreensaver -no-splash
   comhack   2983  0.0  0.0  15200   428 tty1     S    01:46   0:00 /bin/sh /usr/bin/openbox-session
   comhack   3000  0.0  0.0  71048  3524 tty1     S    01:46   0:00 tint
   comhack   3031  0.0  0.2 424680 13816 tty1     S    01:46   0:03 pcmanfm
   comhack   3037  0.0  0.0  61156  2344 tty1     S    01:46   0:00 urxvt -fn xft:Terminal:pixelsize=9
   comhack   3038  0.0  0.0  17432  1304 pts/0    Ss   01:46   0:00 bash
   comhack   3189  0.0  0.1  62776  7712 tty1     S    02:03   0:00 urxvt -fn xft:Terminal:pixelsize=9 -e screen
   comhack   3190  0.0  0.0  22956   976 pts/1    Ss+  02:03   0:00 screen
   comhack   3192  0.0  0.0  17172  1880 pts/2    Ss+  02:03   0:00 /bin/bash
   comhack   3193  0.0  0.1  93636  8168 pts/3    Ss+  02:03   0:11 /usr/local/bin/weechat-curses
   comhack   3194  0.0  0.1  59072  8208 pts/4    Ss+  02:03   0:01 centerim
   comhack   3195  0.0  0.0  17432  1960 pts/5    Ss+  02:03   0:00 /bin/bash
   comhack   3198  0.4  0.0  39224  4024 pts/6    Ss+  02:03   2:17 ncmpcpp
   comhack   3203  0.6  0.0  11632  1896 pts/7    Ss+  02:03   3:00 htop
   comhack   3204  0.0  0.0  17172  1884 pts/8    Ss+  02:03   0:00 /bin/bash
   comhack   4315  0.0  0.1  63372 10072 tty1     S    09:50   0:00 urxvt -fn xft:Terminal:pixelsize=9
   comhack   4316  0.0  0.0  17432  2060 pts/9    Ss   09:50   0:00 bash
   comhack   4322  0.0  0.1  61156  8092 tty1     S    09:51   0:00 urxvt -fn xft:Terminal:pixelsize=9
   comhack   4323  0.0  0.0  17432  2064 pts/10   Ss+  09:51   0:00 bash
   comhack   4344  0.0  0.1  61156  8092 tty1     S    09:58   0:00 urxvt -fn xft:Terminal:pixelsize=9
   comhack   4345  0.0  0.0  17432  2068 pts/11   Ss+  09:58   0:00 bash
   comhack   4378  0.1  0.0 138424  5016 tty1     Sl   10:06   0:01 conky
   comhack   4390  0.0  0.1  61432  8396 tty1     S    10:09   0:00 urxvt -fn xft:Terminal:pixelsize=9
   comhack   4391  0.0  0.0  17432  2060 pts/12   Ss+  10:09   0:00 bash
   comhack   4499  0.0  0.0  10056  1160 pts/9    R+   10:21   0:00 ps u

It seems like the more ram I install the higher the memory cache goes. It did not cache much when I had 2gb of ram.

Thanks


"Every normal man must be tempted at times to spit upon his hands, hoist the black flag, and begin slitting throats." -- H.L. Mencken
Website      Configs
Forum Admin: Bruno's All Things Linux   
securitybreach<a>archlinux.us

Offline

#2 2009-04-14 14:46:23

Dheart
Member
From: Sofia, Bulgaria
Registered: 2006-10-26
Posts: 956

Re: High memory cache?

Well... When you have memory, that is not used, it's practically wasted. Example: "Why would I need 2 GB ram if I use 256 at best?"
That's why it used to cache things in order to make something run faster. If some app requires ram, ram would be immediately freed up.

  -/+ buffers/cache:        798       5164

This line represents the actual memory usage - the memory which is used by your system is 798 mbytes - the other 5 gigs used are cache that can be emptied in literally no time ir order to make place for applications requiring it.

Hope I explained clear enough.


My victim you are meant to be
No, you cannot hide nor flee
You know what I'm looking for
Pleasure your torture, I will endure...

Offline

#3 2009-04-14 15:15:23

securitybreach
Member
From: In front of my computers
Registered: 2007-11-18
Posts: 416
Website

Re: High memory cache?

Thanks it makes sense.


Thanks


"Every normal man must be tempted at times to spit upon his hands, hoist the black flag, and begin slitting throats." -- H.L. Mencken
Website      Configs
Forum Admin: Bruno's All Things Linux   
securitybreach<a>archlinux.us

Offline

#4 2009-04-14 15:17:10

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: High memory cache?

Just so everyone knows, we have a fantastic wiki entry on the subject:

http://wiki.archlinux.org/index.php/FAQ … ktop.3F.21

Offline

Board footer

Powered by FluxBB