#cat /proc/meminfo 详解
$cat /proc/meminfo
MemTotal: 2052440 kB //总内存
MemFree: 50004 kB //空闲内存
Buffers: 19976 kB //给文件的缓冲大小
Cached: 436412 kB //高速缓冲存储器(http://baike.baidu.com/view/496990.htm)使用的大小
SwapCached: 19864 kB //被高速缓冲存储用的交换空间大小
Active: 1144512 kB //活跃使用中的高速缓冲存储器页面文件大小
Inactive: 732788 kB //不经常使用的高速缓冲存储器页面文件大小
Active(anon): 987640 kB //anon:不久
Inactive(anon): 572512 kB
Active(file): 156872 kB
Inactive(file): 160276 kB
Unevictable: 8 kB
Mlocked: 8 kB
HighTotal: 1177160 kB //The total and free amount of memory, in kilobytes, that is not directly mapped into kernel space.
HighFree: 7396 kB // The HighTotal value can vary based on the type of kernel used.
LowTotal: 875280 kB // The total and free amount of memory, in kilobytes, that is directly mapped into kernel space. used.
LowFree: 42608 kB //The LowTotal value can vary based on the type of kernel
SwapTotal: 489940 kB //交换空间总大小
SwapFree: 450328 kB //空闲交换空间
Dirty: 104 kB //等待被写回到磁盘的大小
Writeback: 0 kB //正在被写回的大小
AnonPages: 1408256 kB //未映射的页的大小
Mapped: 131964 kB //设备和文件映射的大小
Slab: 37368 kB //内核数据结构缓存的大小,可减少申请和释放内存带来的消耗
SReclaimable: 14164 kB //可收回slab的大小
SUnreclaim: 23204 kB //不可收回的slab的大小23204+14164=37368
PageTables: 13308 kB //管理内存分页的索引表的大小
NFS_Unstable: 0 kB //不稳定页表的大小
Bounce: 0 kB //bounce:退回
WritebackTmp: 0 kB //
CommitLimit: 1516160 kB
Committed_AS: 2511900 kB
VmallocTotal: 122880 kB //虚拟内存大小
VmallocUsed: 28688 kB //已经被使用的虚拟内存大小
VmallocChunk: 92204 kB
HugePages_Total: 0 //大页面的分配
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 10232 kB
DirectMap2M: 899072 kB
========================================================================================
相应选项中文意思想各位高手已经知道,如何翻译有什么错误,请务必指出:
MemTotal: 所有可用RAM大小 (即物理内存减去一些预留位和内核的二进制代码大小)
MemFree: LowFree与HighFree的总和,被系统留着未使用的内存
Buffers: 用来给文件做缓冲大小
Cached: 被高速缓冲存储器(cache memory)用的内存的大小(等于 diskcache minus SwapCache ).
SwapCached:被高速缓冲存储器(cache memory)用的交换空间的大小
已经被交换出来的内存,但仍然被存放在swapfile中。用来在需要的时候很快的被替换而不需要再次打开I/O端口。
Active: 在活跃使用中的缓冲或高速缓冲存储器页面文件的大小,除非非常必要否则不会被移作他用.
Inactive: 在不经常使用中的缓冲或高速缓冲存储器页面文件的大小,可能被用于其他途径.
HighTotal:
HighFree: 该区域不是直接映射到内核空间。内核必须使用不同的手法使用该段内存。
LowTotal:
LowFree: 低位可以达到高位内存一样的作用,而且它还能够被内核用来记录一些自己的数据结构。Among many
other things, it is where everything from the Slab is
allocated. Bad things happen when you're out of lowmem.
SwapTotal: 交换空间的总大小
SwapFree: 未被使用交换空间的大小
Dirty: 等待被写回到磁盘的内存大小。
Writeback: 正在被写回到磁盘的内存大小。
AnonPages:未映射页的内存大小
Mapped: 设备和文件等映射的大小。
Slab: 内核数据结构缓存的大小,可以减少申请和释放内存带来的消耗。
SReclaimable:可收回Slab的大小
SUnreclaim:不可收回Slab的大小(SUnreclaim+SReclaimable=Slab)
PageTables:管理内存分页页面的索引表的大小。
NFS_Unstable:不稳定页表的大小
Bounce:
CommitLimit: Based on the overcommit ratio ('vm.overcommit_ratio'),
this is the total amount of memory currently available to
be allocated on the system. This limit is only adhered to
if strict overcommit accounting is enabled (mode 2 in
'vm.overcommit_memory').
The CommitLimit is calculated with the following formula:
CommitLimit = ('vm.overcommit_ratio' * Physical RAM) + Swap
For example, on a system with 1G of physical RAM and 7G
of swap with a `vm.overcommit_ratio` of 30 it would
yield a CommitLimit of 7.3G.
For more details, see the memory overcommit documentation
in vm/overcommit-accounting.
Committed_AS: The amount of memory presently allocated on the system.
The committed memory is a sum of all of the memory which
has been allocated by processes, even if it has not been
"used" by them as of yet. A process which malloc()'s 1G
of memory, but only touches 300M of it will only show up
as using 300M of memory even if it has the address space
allocated for the entire 1G. This 1G is memory which has
been "committed" to by the VM and can be used at any time
by the allocating application. With strict overcommit
enabled on the system (mode 2 in 'vm.overcommit_memory'),
allocations which would exceed the CommitLimit (detailed
above) will not be permitted. This is useful if one needs
to guarantee that processes will not fail due to lack of
memory once that memory has been successfully allocated.
VmallocTotal: 可以vmalloc虚拟内存大小
VmallocUsed: 已经被使用的虚拟内存大小。
VmallocChunk: largest contigious block of vmalloc area which is free
下面简单来个例子,看看已用内存和物理内存大小..
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int MemInfo(char* Info, int len);
int main()
{
char buf[128];
memset(buf, 0, 128);
MemInfo(buf, 100);
printf("%s", buf);
return 0;
}
int MemInfo(char* Info, int len)
{
char sStatBuf[256];
FILE* fp;
int flag;
int TotalMem;
int UsedMem;
char* line;
if(system("free -m | awk '{print $2,$3}' > mem"));
memset(sStatBuf, 0, 256);
fp = fopen("mem", "rb");
if(fp < 0)
{
return -1;
}
fread(sStatBuf,1, sizeof(sStatBuf) , fp);
line = strstr(sStatBuf, "/n");
TotalMem = atoi(line);
line = strstr(line, " ");
UsedMem = atoi(line);
memset(sStatBuf, 0, 256);
sprintf(sStatBuf, "Used %dM/Total %dM/n", UsedMem, TotalMem);
if(strlen(sStatBuf) > len)
{
return -1;
}
memcpy(Info, sStatBuf, strlen(sStatBuf));
return 0;
}
结果:Used 488M/Total 495M
参考:http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/en-US/Reference_Guide/s2-proc-meminfo.html
#cat /proc/meminfo 详解的更多相关文章
- /proc/meminfo详解 = /nmon analysis --MEM
memtotal hightotal lowtotal swaptotal memfree highfree lowfree swapfree memshared cached active bigf ...
- /proc/meminfo详解
cat /proc/meminfo 读出的内核信息进行解释, 下篇文章会简单对读出该信息的代码进行简单的分析. MemTotal: 507480 kB MemFree: ...
- cat常用参数详解
cat常用参数详解 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 最近,我的一个朋友对linux特别感兴趣,于是我觉得每天交给他一个命令的使用,这样一个月下来也会使用30个命令,基 ...
- Linux cat /proc/meminfo 输出分析
$cat /proc/meminfoMemTotal: 2052440 kB //总内存MemFree: 50004 kB //空闲内存Buffers: ...
- linux查内存操作:cat /proc/meminfo
https://www.cnblogs.com/zhuiluoyu/p/6154898.html cat /proc/meminfo
- Android内存优化—dumpsys meminfo详解
原创置顶 不死鸟JGC 最后发布于2018-12-24 14:19:28 阅读数 3960 收藏展开dumpsys 介绍Dumpsys用户系统诊断,它运行在设备上,并提供系统服务状态信息 命令格式: ...
- Linux /proc目录详解
Linux系统上的/proc目录是一种文件系统,即proc文件系统.与其它常见的文件系统不同的是,/proc是一种伪文件系统(也即虚拟文件系统),存储的是当前内核运行状态的一系列特殊文件,用户可以通过 ...
- proc文件系统详解(原创)
Linux系统上的/proc目录是一种文件系统,即proc文件系统.与其它常见的文件系统不同的是,/proc是一种伪文件系统(也即虚拟文件系统),存储的是当前内核运行状态的一系列特殊文件,用户可以通过 ...
- /proc/uptime详解
From:http://smilejay.com/2012/05/proc_uptime/ 在Linux中,我们常常会使用到uptime命令去看看系统的运行时间,它与一个文件有关,就是/proc/up ...
随机推荐
- 【一天一道LeetCode】#345. Reverse Vowels of a String
一天一道LeetCode 本系列文章已全部上传至我的github,地址:ZeeCoder's Github 欢迎大家关注我的新浪微博,我的新浪微博 欢迎转载,转载请注明出处 (一)题目 Write a ...
- gradle编译自定义注解(annotation)的未解决问题
最近把一个用eclipse构建的项目,加上了Gradle脚本,用它来编译.虽然最后编译是显示BUILD SUCCESSFUL,但是在编译过程中,却打印出一大堆栈信息,似乎是在编译我自定义的注解时出现的 ...
- ASP.NET遇到HTTP 错误 403.14 - Forbidden Web 服务器被配置为不列出此目录的内容
当碰到这个问题的时候真的是让人很费解啊,就算是重新打开机器也不能够解决,但是下面的小技巧说不一定就可以解决这个问题了. 首先,打开IIS(Internet信息管理服务器),找到"功能&quo ...
- UNIX环境高级编程——pthread_create的问题
linux 下常用的创建多线程函数pthread_create(pthread_t * thread , pthread_attr_t * attr , void *(*start_routine)( ...
- 测试adb功能(后续学习会不断添加)
在安卓中最常用来调试的工具就是ADB,废话不多说,看看几个常用的ADB命令: 1.查看设备的连接状态 在windows cmd中输入 adb devices 会显示设备的相关信息. 2.adb she ...
- C++ Primer 有感(管理类的指针成员)
C++类的指针成员与其他成员有所不同,指针成员指向一个内存地址,该地址的内存需要我没管理. 我现在分析一下为什么要管理指针成员. 有如下Student类,Student.h如下: [cpp] view ...
- Python2.x的UnicodeEncodeError: ‘ascii’ codec can’t encode异常错误
刚遇到这个问题的时候,在网上找了 半天,发现都是说 添加如下三行代码即可解决问题, [python] import sys reload(sys) sys.setdefaultencoding('ut ...
- How to Enable Trace or Debug for APIs executed as SQL Script Outside of the Applications ?
In this Document Goal Solution 1: How do you enable trace for an API when executed from a SQL ...
- 集群通信组件tribes之集群的平行通信
前面的集群成员维护服务为我们提供了集群内所有成员的地址端口等信息,可以通过MembershipService可以轻易从节点本地的成员列表获取集群所有的成员信息,有了这些成员信息后就可以使用可靠的TCP ...
- STL(标准模板库)理论基础,容器,迭代器,算法
基本概念 STL(Standard Template Library,标准模板库)是惠普实验室开发的一系列软件的统称.现然主要出现在C++中,但在被引入C++之前该技术就已经存在了很长的一段时间. ...