Hi, I have a very weird memory issue (as you may have guessed from the title :) ). There's a discrepency between the memory accumulated by the various applications (using "ps -eF" to collect that) and the memory reported by system monitor/"free". Basically, I have around 0.5GB of memory that is not occupied by any application, but is not free as well. (It is not used as cache as well) I restarted X (logged out and in again), but it didn't help. free's output: total used free shared buffers cached Mem: 4056964 2874328 1182636 0 481360 592220 -/+ buffers/cache: 1800748 2256216 Swap: 6723160 31412 6691748 and on the other hand: $ ps -eF | grep -v COMMAND | awk '{rsum+=$6}END{print rsum}' 1309016 I'm running Ubuntu 9.10 64bit. I had some zombie processes, but I killed their parent process and that made them go away (and freed up some memory, but not all that's missing) Any ideas how to further debug this would be appreciated. Thanks! |
It is RAM caching. Google "linux ram cache" there are lots of results will help you. Actually that memory is free, there is nothing to worry about. answered 15 Apr '10, 13:47 Web31337 If it's not used by cache, how much uptime do you have? Maybe some app has memory leak?
(15 Apr '10, 13:56)
Web31337
12 days uptime. AFAIK if an app leaks memory, its memory consumption grows and when it is killed, that memory is freed. I restarted X (which killed all apps) and still missing 0.5G. Unless there's something I'm missing...
(15 Apr '10, 14:03)
Yeeeev
|
OK, OK, it is cache... Just a rather peculiar one I wasn't aware of.
I thought this issue might be related to a kernel memory leak, which led me to run slabtop.
There I saw that "ext4_inode_cache" is just about the size of RAM I'm missing. (700MB) Thanks! answered 15 Apr '10, 22:28 Yeeeev so can we have cron run "sync; echo 3 > /proc/sys/vm/drop_caches" at lets say 1am, for non-server systems... or is this completely useless?
(15 Apr '10, 23:47)
george
It's pointless, if an application needs RAM Linux will dump part of the cache and hand it over. It opportunistically uses unallocated RAM to speed things up since it's better than having unused RAM just sitting there. The cache never takes priority over real memory AFAIK. Also in the OP's post if you take buffers + cache in his output it's just under free. free + used is also equal to total. buffers and cache are sitting in his free memory until used.
(08 May '10, 02:51)
hippiejake
|
As "ed" said, is cache. Just look at your swap file. Is not being used, meaning that you are not short of RAM. Linux will try to use all RAM it can as that will optimize the system. Some of it is not considered cache, but swap (RAM, not disk). When a program request memory, it will be assigned from the free memory store. When is freed again, it will not be cleaned up, it will just be marked as available. If another request come this available memory will be assigned. If you run out of available memory, then something will send to disk (swap), to be recovered when needed again. Don't worry. Your memory is being well and fully used. answered 17 Apr '10, 18:44 LiquidPaper |
Please accept an answer so the question/answer can be finished. Or provide more details so we can help.