Test-maxMem.C
Go to the documentation of this file.
1 #include <iostream>
2 #include <stdlib.h>
3 using namespace std;
4 
5 int main(int argc, char *argv[])
6 {
7  if (argc != 2)
8  {
9  cerr << "Usage: " << argv[0] << " <number of Mb per chunk>\n";
10  exit(1);
11  }
12 
13  int nBytes = (1024U*1024U)*atoi(argv[1]);
14 
15  char *cPtr;
16 
17  for (unsigned i=1;; i++)
18  {
19  cPtr = new char[nBytes];
20 
21  /*
22  for (int j=0; j<nBytes; j++)
23  {
24  cPtr[j] = 0;
25  }
26  */
27 
28  cout << "allocated " << i*nBytes/(1024U*1024U) << " Mbytes" << endl;
29  }
30 
31  return 0;
32 }
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
U
U
Definition: pEqn.H:46
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
main
int main(int argc, char *argv[])
Definition: Test-maxMem.C:5