Linux – the buffers column in the output from free

cachelinuxmemory

These questions briefly list the format of the free command, noting that buffers is kernel memory that must be written out to disk and cache is file data that does not need to be written disk.

On my system, unlike most times I have run free, buffers occupies over 10% of RAM. Usually, buffers are a small, almost token, value.

My question is, what exactly is in the area called buffers? Can I look for it with lsof? Does it consist of open file regions that have not been flushed? Is it memory mapped file regions? What is it?

The system runs well and little swap is used, so performance is fine.

Best Answer

free pulls its data from /proc/meminfo

slkwr133701:/usr/src/linux # free

             total       used       free     shared    buffers     cached
Mem:       2053456     434572    1618884          0      77888     201820

slkwr133701:/usr/src/linux # cat /proc/meminfo

MemTotal:        2053456 kB
MemFree:         1618736 kB
Buffers:           77928 kB
....

This refers to memory used for temporary block I/O storage. The kernel has to assign and free the same size units constantly like block I/O transfers, network packets, and socket buffers

You can get a better look at caches and buffer allocations by running slabtop

In response to your usage question: The system will typically allocate more blocks than it needs but as the "memory pressure" increases these additional blocks will be released.