18

The output of the top command shows that 29GB of memory is used by "buff/cache". What does it mean and how I can free it? It is near to 90% of memory.

enter image description here

3

1 Answer 1

33

You don't need to free "buff/cache".

"buff/cache" is memory that Linux uses for disk caching, and that will be freed whenever applications require it. So you don't have to worry if a large amount is being shown in this field, as it doesn't count as "used" memory.

Quoted from http://www.linuxatemyram.com (emphasis mine):

Both you and Linux agree that memory taken by applications is "used", while memory that isn't used for anything is "free".

But how do you count memory that is currently used for something, but can still be made available to applications?

You might count that memory as "free" and/or "available". Linux instead counts it as "used", but also "available". (...) This "something" is (roughly) what top and free calls "buffers" and "cached". Since your and Linux's terminology differs, you might think you are low on ram when you're not.

3
  • 2
    Thank you for the clarification.
    – Player1
    Jun 9, 2020 at 17:23
  • 2
    i got a problem with WSL2 linux, it is cache in wsl linux, but it's the real amount of RAM that windows allocated for
    – Dee
    Jun 14, 2020 at 9:54
  • 1
    EXCEPTION: Note that ramfs is part of "buff/cache" so if you have some ramfs mounting points and use significant space in these you do need to keep an eye and "free it". And the only way to measure the space used by ramfs is using du on each mounting point since df doesn't keep count of that (this is what makes ramfs so fast).
    – FlorianB
    Dec 16, 2020 at 18:09

Not the answer you're looking for? Browse other questions tagged or ask your own question.