dev/c/bigmalloc/bignew.cpp

22 lines
315 B
C++

//#include <unistd.h>
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int sz = 1024*1024*1024;
cout<<sz;
char * m = new char[sz];
if(m==NULL)
{
cout<<"new failed\n";
exit(-1);
}
for(int i=0; i<sz; i++) m[i]=0;
sleep(5);
// delete m;
return 0;
}