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!

asked 15 Apr '10, 13:21

Yeeeev's gravatar image

Yeeeev
3113
accept rate: 0%

edited 15 Apr '10, 13:49

Web31337's gravatar image

Web31337
317111

Please accept an answer so the question/answer can be finished. Or provide more details so we can help.

(20 Apr '11, 13:44) rfelsburg ♦



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.

link

answered 15 Apr '10, 13:47

Web31337's gravatar image

Web31337
317111
accept rate: 11%

edited 15 Apr '10, 13:54

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)
I ran "sync; echo 3 > /proc/sys/vm/drop_caches" and that cleared everything right up... The funny thing is that the slab memory is not reported in system monitor/free as cached memory, but rather as used.

Thanks!

link

answered 15 Apr '10, 22:28

Yeeeev's gravatar image

Yeeeev
3113
accept rate: 0%

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.

link

answered 17 Apr '10, 18:44

LiquidPaper's gravatar image

LiquidPaper
12113
accept rate: 0%

You only had to read as far as the first sentence to note that he believes cache is not the issue.

link

answered 15 Apr '10, 13:50

Paul's gravatar image

Paul
211
accept rate: 0%

Other than caches I would guess that this likely the ram used by the kernel processes.

link

answered 06 May '10, 20:42

tychoish's gravatar image

tychoish
11
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×6
×3
×1

Asked: 15 Apr '10, 13:21

Seen: 3,823 times

Last updated: 20 Apr '11, 13:44

powered by OSQA