C查看分配给用户的内存及分配给系统的内存大小

来源:互联网 发布:ubuntu安装gnome2 编辑:程序博客网 时间:2024/05/16 07:13
#include <iostream>#include <malloc.h>#include <stdlib.h>using namespace std;int main(){int count = 0;while(malloc(1204*1204)){count++;}cout<<count<<endl;cout<<(count/1024)<<"G"<<endl;return 0;}
我的总内存是4G,实际上分配给用户的只有2G多点,还有接近2G的内存是分配给系统的。
0 0