how to analyze buff/cache memory

id flag

When I use free -m I get be below information

Before system restart

              total        used        free      shared  buff/cache   available
Mem:          31549         809         369        1567       30371       28729
Swap:             0           0           0

After system restart

              total        used        free      shared  buff/cache   available
Mem:          31549         405       30809          37         334       30767
Swap:             0           0           0

Ater restart the buff/cache memory started to increase gradually till. Is there a way to analyse which processor are occupying space in buff/cache. Also is it possible to see what is occupying buff/cache?

ae flag

buff/cache refers to a portion of memory maintained by the operating system and used for "page cache" - used for caching the content of files to speed up disk IO. This is memory that, if needed, can be freed for other purposes - that's why you also see a lot of memory in the available column.

You shouldn't normally be worried about it - it's the responsibility of the kernel to manage this.

But sometimes, it can signal issues such as missing log file rotation - there's a great talk here about this specific problem and how to analyze it with Async Profiler:

By profiling this perf event: enter image description here

There are also programs like fincore and vmtouch that can be used on a specific file or even directory (vmtouch) to show how much space they occupy in the page cache

$ vmtouch .
           Files: 81989
     Directories: 8351
  Resident Pages: 297/1672196  1M/6G  0.0178%
         Elapsed: 0.8893 seconds

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.