What is in the cache memory and why does so much of it get used?

Almost all of my memory is being used up by the cache. There are two other posts that suggest this is normal behavior for OpenWRT?

What is in the cache and why is it so big? Should it be flushed on a regular basis like this post says can be done?

Because Linux uses "free" memory to cache files automatically — it's not memory that's "lost" or "wasted."

  • If an application needs memory, the kernel will immediately reclaim cached memory as needed.
  • Cache will grow when memory isn’t in demand and shrink when it is.

The cache is mainly:

  • Page cache: Recently accessed files or file system data
  • Dentry/inode cache: Directory and file metadata
  • Buffer cache: Raw disk blocks (less common in modern systems)

These caches help reduce read/write latency by keeping frequently accessed data in RAM. Bottomline don't touch this ... :wink:

2 Likes

Cool. Thank you!