下篇对cat /proc/meminfo读出该信息进行简单的分析。
MemTotal: 507480 kB
MemFree: 10800 kB
Buffers: 34728 kB
Cached: 98852 kB
SwapCached: 128 kB
Active: 304248 kB
Inactive: 46192 kB
HighTotal: 0 kB
HighFree: 0 kB
LowTotal: 507480 kB
LowFree: 10800 kB
SwapTotal: 979956 kB
SwapFree: 941296 kB
Dirty: 32 kB
Writeback: 0 kB
AnonPages: 216756 kB
Mapped: 77560 kB
Slab: 22952 kB
SReclaimable: 15512 kB
SUnreclaim: 7440 kB
PageTables: 2640 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
CommitLimit: 1233696 kB
Committed_AS: 828508 kB
VmallocTotal: 516088 kB
VmallocUsed: 5032 kB
VmallocChunk: 510580 kB
SwapTotal: 交换空间的总大小
SwapFree: 未被使用交换空间的大小
Dirty: 等待被写回到磁盘的内存大小
Writeback: 正在被写回到磁盘的内存大小。
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
在编写一个小的jquery程序后,运行html页面,发现浏览器报错:检查发现自己没有引入jquery的js文件,于是在js代码下引入该文件:保存后运行页面,发现依然会报错。将对jquery的js文件引用提前即可解决该问题。总结如下:1.jQuery库文件的路径不对,检查文件路径是否正确一般就能解决该错误。 2.如果库文件的路径是正确
BOM:Browser Object Model:浏览器对象模型,用来访问和操纵浏览器窗口,使js有能力与浏览器“对话”,通过使用BOM,可移动窗口、更改状态文本、执行其他不与页面内容发生直接联系第操作,且没有相关标准,但被广泛支持。1、外部对象就是浏览器提供(内部)的API2、这些对象由W3C规定,由浏览器开发者设计并开发3、这些对象分为2部分,其中BOM包含了DOM4、我们
string字符类型一、介绍String类型是redis的最基础的数据结构,也是最经常使用到的类型,其值最大能存储512MB可以存简单字符串、复杂的xml/json的字符串、二进制图像或者音频的字符串、以及可以是数字的字符串string底层使用的是SDS,是Redis的一种基本数据结构,主要是用于存储字符串和整数二、常用命令set命令【set key value】该命令用于设置给定key的值。如果key已经存储其他值,SET就覆盖写入,且无视类型get命令【get key】该命令用于获取指
在编写智能合约的时候,如果编译时出现类似以下的异常,请不要奇怪也不要灰心丧气,你很可能只是犯了一个很低级的错误。比如即使在照抄别人的代码的时候在某一行特别是,pragma声明那一行最后少写一个“;”,就会导致这样的异常。Solidity: ParserError: Expected pragma, import directive or contract/interface/library...
示例图1<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>a-test</title><meta name="viewport" content="width=device-width, initial-scale=1....
UML类图和关系类图 - 依赖关系(Dependence)**应用案例****Java代码****UML类图 + PlantUML代码****小结**类图 - 泛化关系(generalization)**应用案例****Java代码****UML类图 + PlantUML代码****小结**类图—实现关系(Implementation)**应用案例****Java代码****UML类图 + PlantUML代码**类图—关联关系(Association)**应用案例****Java代码****UML类图 +
MATLAB简单实现图片的标注,手工完成ground truth的注释标注%对图片上某个点进行标注clear allclose allclcset(gcf,'color','white')src='';for i=1:200num = istr = '.jpg' ;Mstr='.mat';filestr='D:/Program/'; %要标注图片的位置refilestr='D:/Progr...
16级计算机科学与技术, 网络工程同学的课程项目文档, 已经上传至网盘: https://pan.baidu.com/s/1rEFKstAjqIuQtZD0GTUuYA
时间限制:1 秒内存限制:32 兆特殊判题:否提交:1470解决:1155题目描述:名名的妈妈从外地出差回来,带了一盒好吃又精美的巧克力给名名(盒内共有 N 块巧克力,20 > N >0)。妈妈告诉名名每天可以吃一块或者两块巧克力。假设名名每天都吃巧克力,问名名共有多少种不同的吃完巧克力的方案。例如:如果N=1,则名名第1天就
1. HDFS的文件append功能早期版本的HDFS不支持任何的文件更新操作,一旦一个文件创建、写完数据、并关闭之后,这个文件就再也不能被改变了。为什么这么设计?是为了与MapReduce完美配合,MapReduce的工作模式是接受一系列输入文件,经过map和reduce处理,直接产生一系列输出文件,而不是在原来的输入文件上做原位更新。为什么这么做?因为直接输出新文件比原位更新一个旧文件高效的多。在HDFS上,一个文件一直到它的close方法成功执行之后才会存在,才能被其他的client端所看见。如果
视觉SLAM深蓝学院作业解答(正在更新)3-6 轨迹的描绘最近整理一下之前所做的深蓝学院视觉SLAM课程的作业,因为发现从做作业的过程中收获很大。3-6 轨迹的描绘程序代码:#include <sophus/se3.h>#include <string>#include <iostream>#include <fstream>#in...
场景描述添加自定义的弹出框后,当滚动鼠标时下边的页面也会跟着滚动。解决方案为了在遮罩出现的时候禁止用户滑动页面,如下处理:给这个遮罩层 绑定事件: 使用 catchtouchmove(1)在弹出层上添加 catchtouchmove=’true’<!--弹出框 --><view class="sh_Model_box" catchtouchmove='true'>...</view>(2)也可以绑定有一个空事件 <view cat