openfoam/applications/test/maxMem/maxMem.C
Mark Olesen 4b60453cf1 use while (runTime.loop() { .. } where possible in solvers
- change system/controlDict to use functions {..} instead of functions (..);
  * This is internally more efficient
- fixed formatting of system/controlDict functions entry

- pedantic change: use 'return 0' instead of 'return(0)' in the applications,
  since return is a C/C++ keyword, not a function.
2009-02-18 08:57:10 +01:00

33 lines
555 B
C

#include <iostream>
#include <stdlib.h>
using namespace std;
int main(int argc, char *argv[])
{
if (argc != 2)
{
cerr << "Usage: " << argv[0] << " <number of Mb per chunk>\n";
exit(1);
}
int nBytes = (1024U*1024U)*atoi(argv[1]);
char *cPtr;
for (unsigned i=1;; i++)
{
cPtr = new char[nBytes];
/*
for (int j=0; j<nBytes; j++)
{
cPtr[j] = 0;
}
*/
cout << "allocated " << i*nBytes/(1024U*1024U) << " Mbytes" << endl;
}
return 0;
}