使用/proc/meminfo文件查看内存状态信息
在Linux下可以使用/proc/meminfo文件查看操作系統內存的使用狀態
#?cat?/proc/meminfo? MemTotal:???????16333852?kB MemFree:?????????1633564?kB Buffers:??????????212448?kB Cached:??????????4422808?kB SwapCached:????????????0?kB Active:?????????10343096?kB Inactive:????????3784128?kB Active(anon):????7954776?kB Inactive(anon):??1537404?kB Active(file):????2388320?kB Inactive(file):??2246724?kB Unevictable:???????????0?kB Mlocked:???????????????0?kB SwapTotal:???????2047992?kB SwapFree:????????2047992?kB Dirty:???????????????672?kB Writeback:?????????????0?kB AnonPages:???????9491968?kB Mapped:????????????34240?kB Shmem:???????????????212?kB Slab:?????????????375180?kB SReclaimable:?????316296?kB SUnreclaim:????????58884?kB KernelStack:???????27456?kB PageTables:????????35396?kB NFS_Unstable:??????????0?kB Bounce:????????????????0?kB WritebackTmp:??????????0?kB CommitLimit:????10214916?kB Committed_AS:???19743752?kB VmallocTotal:???34359738367?kB VmallocUsed:??????303556?kB VmallocChunk:???34359420140?kB HardwareCorrupted:?????0?kB AnonHugePages:?????????0?kB HugePages_Total:???????0 HugePages_Free:????????0 HugePages_Rsvd:????????0 HugePages_Surp:????????0 Hugepagesize:???????2048?kB DirectMap4k:???????10240?kB DirectMap2M:????16766976?kB注意這個文件顯示的單位是kB而不是KB,1kB=1000B,但是實際上應該是KB,1KB=1024B
這個顯示是不精確的,是一個已知的沒有被更正的歷史遺留問題。因為很多程序依賴這個文件查看內存使用的是kB字符
? ? ?MemTotal是可使用內存的總量,單位是KB,物理內存減去一些保留內存和內核二進制代碼占用的內存
? ? ?MemFree 剩下沒有被使用的物理內存,單位是kibibytes,即KB
?
Buffers:??????????212448?kB? ? ?Buffers 臨時存儲原始磁盤塊的總量,單位是KB
? ? ?Cached 用作緩存內存的物理內存總量,單位是KB
? ? ?SwapCached 曾經被移入到swap,然后又回到主內存,但是仍然也在swapfile中保留的總內存大小。這樣可以節省I/O,應為內存不需要再移入到swap
? ? ?Active 最近經常被使用的內存大小總量,單位是KB。
? ? ?Inactive 最近不是經常使用的內存,單位是KB
? ? ?匿名和tmpfs/shmem內存總量,單位是KB. 自上次系統移動一些什么東西到swap后處于活動使用狀態或者之前處于活動使用狀態的內存
? ? ?作為候選收回的匿名和tmpfs/shmen內存總量,單位是KB
? ? ?文件緩存內存的總量,單位是KB。處于活動使用狀態,或者之前自上次系統召回內存處于活動使用狀態的內存
? ?
Unevictable:???????????0?kB? ? ? The amount of memeory,in kibibytes,discovered by the pageout code,that is not evictable because it is locked into memeory by user programs.
? ? ?因為被用戶程序鎖住不能被回收的內存總量,單位是KB
SwapTotal:
? ? ?swap總量,單位是KB
SwapFree:?
? ? ?空閑swap總量
Dirty ?等待寫回到磁盤內存總量,單位是KB
Writeback ? 正在寫回到磁盤的內存總量,單位是KB
AnonPages ? The total amount of memory,in kibibytes,used by pages that are not backed by files and are mapped into userspace page tables
Mapped ? ? The memory,in kibibytes, used for files that have been mmaped,such as libraries
Shmem ? ? The total amount of memeory,in kibibytes,used by shared memeory(shmem) and tmpfs
Slab ? ? The total amount of memeory,in kibibytes,used by the kernel to cache data structures for its own use.
SReclaimable ? The part of Slab that can be reclaimed,such as caches.
SUnreclaim ? ?The part of Slab that cannot be reclaimed even when lacking memeory
KernelStack ? The amount of memeory,in kibibytes,used by the kernel stack allocations done for each task in the system
PageTables ? The total amount of memeory,in kibibytes,dedicated to the lowest page table level.
NFS_Unstable ?The amount,in kibibytes,of NFS page sent to the server but not yet committed to the stable storage
Bounce ? The amount of memory,in kibibytes,used for the block device "bounce buffers"
WritebackTmp ? The amount of memory,in kibibytes, used by FUSE for temporary writeback buffers
CommitLimit ? The total amount of memory currently avaiable to be allocated on the system based on the overcommit ratio(vm.overcommit_ratio) This limit is only adhered of if stric overcommit accounting is enabled(mode 2 in vm.overcommit_memory)?
? 例如1G的物理內存和7GB的swap內存,vm.overcommit_ratio設置為30,那么CommitLimit 就是7.3GB
Committed_AS ? The total amount of memory,in kibibytes,estimated to complete the workload.
? ? ? ? ? This value repsents the worst case scenario value,and also includes swap memory
VMallocTotal ?The total amount of memory,in kibibytes,of total allocated virtual address space
VMallocUsed?— The total amount of memory, in kibibytes, of used virtual address space.
VMallocChunk?— The largest contiguous block of memory, in kibibytes, of available virtual address space.
HardwareCorrupted?— The amount of memory, in kibibytes, with physical memory corruption problems, identified by the hardware and set aside by the kernel so it does not get used.
AnonHugePages?— The total amount of memory, in kibibytes, used by huge pages that are not backed by files and are mapped into userspace page tables.
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.
HugePages_Rsvd?— The number of unused huge pages reserved for hugetlbfs.
HugePages_Surp?— The number of surplus huge pages.
Hugepagesize?— The size for each hugepages unit in kibibytes. 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.
DirectMap4k?— The amount of memory, in kibibytes, mapped into kernel address space with 4 kB page mappings.
DirectMap2M?— The amount of memory, in kibibytes, mapped into kernel address space with 2 MB page mappings.
參考文檔:
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s2-proc-meminfo.html
轉載于:https://blog.51cto.com/john88wang/1827844
總結
以上是生活随笔為你收集整理的使用/proc/meminfo文件查看内存状态信息的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: codeforces 234E Cham
- 下一篇: 梦到胎停是怎么回事