Questions tagged [meminfo]

This is one of the more commonly used files in the /proc/ directory, as it reports a large amount of valuable information about the systems RAM usage.

This is one of the more commonly used files in the /proc/ directory, as it reports a large amount of valuable information about the systems RAM usage.

The following sample /proc/meminfo virtual file is from a system with 256 MB of RAM and 512 MB of swap space:

MemTotal:       255908 kB 
MemFree:         69936 kB 
Buffers:         15812 kB 
Cached:         115124 kB 
SwapCached:          0 kB 
Active:          92700 kB 
Inactive:        63792 kB 
HighTotal:           0 kB 
HighFree:            0 kB 
LowTotal:       255908 kB 
LowFree:         69936 kB 
SwapTotal:      524280 kB 
SwapFree:       524280 kB 
Dirty:               4 kB 
Writeback:           0 kB 
Mapped:          42236 kB 
Slab:            25912 kB 
Committed_AS:   118680 kB 
PageTables:       1236 kB 
VmallocTotal:  3874808 kB 
VmallocUsed:      1416 kB 
VmallocChunk:  3872908 kB 
HugePages_Total:     0 
HugePages_Free:      0 
Hugepagesize:     4096 kB

Much of the information here is used by the free, top, and ps commands. In fact, the output of the free command is similar in appearance to the contents and structure of /proc/meminfo. But by looking directly at /proc/meminfo, more details are revealed:

  • MemTotal — Total amount of physical RAM, in kilobytes.
  • MemFree — The amount of physical RAM, in kilobytes, left unused by the system.
  • Buffers — The amount of physical RAM, in kilobytes, used for file buffers.
  • Cached — The amount of physical RAM, in kilobytes, used as cache memory.
  • SwapCached — The amount of swap, in kilobytes, used as cache memory.
  • Active — The total amount of buffer or page cache memory, in kilobytes, that is in active use. This is memory that has been recently used and is usually not reclaimed for other purposes.
  • Inactive — The total amount of buffer or page cache memory, in kilobytes, that are free and available. This is memory that has not been recently used and can be reclaimed for other purposes.
  • HighTotal and HighFree — The total and free amount of memory, in kilobytes, that is not directly mapped into kernel space. The HighTotal value can vary based on the type of kernel used.
  • LowTotal and LowFree — The total and free amount of memory, in kilobytes, that is directly mapped into kernel space. The LowTotal value can vary based on the type of kernel used.
  • SwapTotal — The total amount of swap available, in kilobytes.
  • SwapFree — The total amount of swap free, in kilobytes.
  • Dirty — The total amount of memory, in kilobytes, waiting to be written back to the disk.
  • Writeback — The total amount of memory, in kilobytes, actively being written back to the disk.
  • Mapped — The total amount of memory, in kilobytes, which have been used to map devices, files, or libraries using the mmap command.
  • Slab — The total amount of memory, in kilobytes, used by the kernel to cache data structures for its own use.
  • Committed_AS — The total amount of memory, in kilobytes, estimated to complete the workload. This value represents the worst case scenario value, and also includes swap memory.
  • PageTables — The total amount of memory, in kilobytes, dedicated to the lowest page table level.
  • VMallocTotal — The total amount of memory, in kilobytes, of total allocated virtual address space.
  • VMallocUsed — The total amount of memory, in kilobytes, of used virtual address space.
  • VMallocChunk — The largest contiguous block of memory, in kilobytes, of available virtual address space.
  • HugePages_Total — The total number of hugepages for the system. The number is derived by dividing Hugepagesize by the megabytes set aside for hugepages specified in /proc/sys/vm/hugetlb_pool. This statistic only appears on the x86, Itanium, and AMD64 architectures.
  • HugePages_Free — The total number of hugepages available for the system. This statistic only appears on the x86, Itanium, and AMD64 architectures.
  • Hugepagesize — The size for each hugepages unit in kilobytes. By default, the value is 4096 KB on uniprocessor kernels for 32 bit architectures. For SMP, hugemem kernels, and AMD64, the default is 2048 KB. For Itanium architectures, the default is 262144 KB. This statistic only appears on the x86, Itanium, and AMD64 architectures.
18 questions
293
votes
9 answers

How to display meminfo in megabytes in top?

Sometimes it is not comfortable to see meminfo in kilobytes when you have several gigs of RAM. In Linux, it looks like: And here is how it looks in Mac OS X: Is there a way to display meminfo in Linux top in terabytes, gigabytes and megabytes?
Anthony Ananich
  • 7,234
  • 5
  • 31
  • 45
14
votes
2 answers

How can I get the amount of available memory portably across distributions?

The standard files/tools that report memory seem to have different formats on different Linux distributions. For example, on Arch and Ubuntu. Arch $ free total used free shared buff/cache available Mem: …
terdon
  • 234,489
  • 66
  • 447
  • 667
11
votes
2 answers

Is "Cached" memory de-facto free?

When running cat /proc/meminfo, you get these 3 values at the top: MemTotal: 6291456 kB MemFree: 4038976 kB Cached: 1477948 kB As far as I know, the "Cached" value is disk caches made by the Linux system that will be freed…
Roland Seuhs
  • 325
  • 1
  • 3
  • 12
11
votes
1 answer

What is using 4GB of memory? (Not cache, not a process, not slab, not shm)

We have some EC2 servers that experience a memory leak over days or weeks. Eventually there gets to be many GB of memory that is used (according to tools like free and htop) and, if we don't restart the server, our processes start getting…
Caleb Spare
  • 211
  • 1
  • 3
6
votes
1 answer

Recover from faking /proc/meminfo

So, without really thinking too much, I ran this script: #!/bin/bash SWAP="${1:-512}" NEW="$[SWAP*1024]"; TEMP="${NEW//?/ }"; OLD="${TEMP:1}0" sed "/^Swap\(Total\|Free\):/s,$OLD,$NEW," /proc/meminfo > /etc/fake_meminfo mount --bind /etc/fake_meminfo…
Lauri Elias
  • 163
  • 5
5
votes
1 answer

How are /proc/meminfo values calculated?

/!\ Current state: Update 4 /!\ Some /proc/meminfo values are a sum or a difference of some other values. However, not much is said about how they are calculated in these two links (just do ctrl-f meminfo to get…
X.LINK
  • 1,288
  • 9
  • 18
4
votes
1 answer

different kernels report different amounts of total memory on the same machine

I have two x86_64 kernels compiled on the same machine against the same code (4.15.0 in Linus' source tree). The config files were produced by running make localmodconfig against that source, using different, larger original config files coming from…
grobber
  • 59
  • 4
4
votes
1 answer

When is swap triggered or how to calculate swap_tendency?

I'm trying to use Redis for production services and trying to avoiding swapping, which is bad for performance. I had learn that swap is triggered by swap_tendency which is depending on swap_tendency = mapped_ratio/2 + swappiness + distress How can…
Zhuo.M
  • 143
  • 1
  • 6
3
votes
2 answers

How to diagnose high `Shmem`? (was: Why `echo 3 > drop_caches` cannot zero the cache?)

I have a problem with my Linux machine where system now seems to run easily out of RAM (and trigger OOM Killer) when it normally can handle similar load just fine. Inspecting free -tm shows that buff/cache is eating lots of RAM. Normally this would…
Mikko Rantalainen
  • 3,899
  • 1
  • 25
  • 32
3
votes
0 answers

In meminfo, sometimes Mapped more than Cached

In /proc/meminfo, AFAIK Cached >= Mapped But after /proc/sys/vm/drop_caches, it goes to Cached < Mapped Cached: 66132 kB Mapped: 67792 kB /proc/meminfo contents after: MemTotal: 369020 kB MemFree: 34588…
Hwangho Kim
  • 131
  • 1
2
votes
1 answer

How to troubleshoot what eats memory?

I'm trying to figure out why memory consumption started to constantly increase on my server during the last hours. I've tried to find the cause on the application level, but no success. That is why now looking into possible server cause. I'm not a…
Y. E.
  • 123
  • 1
  • 1
  • 6
1
vote
1 answer

Linux server high memory usage without applications

I have an Ubuntu 20.04.4 server with 32GB RAM. The server is running a bunch of LXD containers and two VMs (libvirt+qemu+kvm). After startup, with all services running, the RAM utilization is about ~12GB. After 3-4 weeks the RAM utilization reaches…
1
vote
1 answer

Why is VmallocTotal 34359738367 kB?

/proc/meminfo has a memory statistic VmallocTotal. It is described as Total size of vmalloc memory area. in proc's man page and elsewhere as Total memory available in kernel for vmalloc allocations It sparked my curiosity because it is a very…
1
vote
1 answer

How to find the right memory size?

We have a Linux machine with 32G. We capture the mem as follows: mem=` cat /proc/meminfo | grep MemTotal | awk '{print $2}' ` echo $mem 32767184 and now we convert it to GIGA: mem_in_giga=` echo $(( $mem / 1024 / 1024)) ` echo $mem_in_giga 31 but…
yael
  • 12,598
  • 51
  • 169
  • 303
1
vote
0 answers

Investigating Active MemInfo

I am seeing high Active usage when I do a cat /proc/meminfo : MemTotal: 65965328 kB MemFree: 51640992 kB Buffers: 1050332 kB Cached: 8516112 kB SwapCached: 0 kB Active: 11512732 kB Inactive: 1878028 kB HighTotal: 0 kB HighFree: 0 kB LowTotal:…
1
2