So I have a system with linux kernel 4.14.73 in which I am using values from /proc/meminfo in an program that shows the system specs including memory used and memory reserved. All was well until I saw something really weird: the total committed memory is less than the used memory ( or in /proc/meminfo terms COMMITTED_AS < MEMTOTAL - MEMAVAILABLE). Here is the output of /proc/meminfo :
# cat /proc/meminfo MemTotal: 32911616 kB MemFree: 32322628 kB MemAvailable: 32360768 kB Buffers: 4604 kB Cached: 304088 kB SwapCached: 0 kB Active: 83876 kB Inactive: 263204 kB Active(anon): 46680 kB Inactive(anon): 152 kB Active(file): 37196 kB Inactive(file): 263052 kB Unevictable: 83788 kB Mlocked: 83788 kB SwapTotal: 0 kB SwapFree: 0 kB Dirty: 0 kB Writeback: 0 kB AnonPages: 122204 kB Mapped: 22348 kB Shmem: 1328 kB Slab: 52696 kB SReclaimable: 28548 kB SUnreclaim: 24148 kB KernelStack: 2896 kB PageTables: 2348 kB NFS_Unstable: 0 kB Bounce: 0 kB WritebackTmp: 0 kB CommitLimit: 32911616 kB Committed_AS: 366544 kB VmallocTotal: 34359738367 VmallocUsed: 0 kB VmallocChunk: 0 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB DirectMap4k: 47004 kB DirectMap2M: 4050944 kB DirectMap1G: 29360128 kB
So this gives me ~538MB of used memory but only ~358MB of committed memory! How is it possible that the total allocated memory in the system is less than the used memory?? Or can someone point out if I'm doing something wrong here?
Plz, any pointers on what is going on here would be greatly appreciated!!