D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Caching - was out of memory

 

On Fri, 6 Sep 2013, Tom wrote:

IIRC now - one thing the kernel does is cache everything - you open a file and close it and flush it its flushed but its still in memory in case you want to open it again. This is actually pretty cool behaviour and if you've got a big app not written to process a lot of configuration files at startup then the second and subsequent loads are pretty quick compared with the original.

Sure, but it was pretty obvious in my posting that I was on about a single program using 1.8GB of ram, not the caching. If you added up the buffers + cache it wouldn't equate to 1.8G - which was easy to see from the top output.

currently it looks like:

KiB Mem:   3831912 total,  3542060 used,   289852 free,   228892 buffers
KiB Swap:        0 total,        0 used,        0 free,   848412 cached

  PID USER      PR  NI  VIRT  RES  SHR S  %CPU %MEM    TIME+  COMMAND
13071 gordon    20   0 1961m 1.4g  15m S   0.0 37.2 439:11.46 gnome-shell

Looks like it's grown since this morning too. 1.9GB (And note that the cache + buffer totals is only about 1G, so hard to confuse with a program using over 1.8G)

So that's one program using 1.4G of real ram with about 0.5G of code space/libraries sitting on disk (or paged into RAM) Incredible.

You can drop the caches if you want

  echo 3 > /proc/sys/vm/drop_caches

but it doesn't change what programs thesmselves are using:

KiB Mem:   3831912 total,  3139380 used,   692532 free,      428 buffers
KiB Swap:        0 total,        0 used,        0 free,   687468 cached

  PID USER      PR  NI  VIRT  RES  SHR S  %CPU %MEM    TIME+  COMMAND
13071 gordon    20   0 1961m 1.4g  15m S   6.3 37.2 440:21.79 gnome-shell

All its doing is wasting memory for no reason that's clear at all.

Gordon


--
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq