#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的内存是分配给系统的。