mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
Add the OpenFOAM source tree
This commit is contained in:
32
applications/test/maxMem/Test-maxMem.C
Normal file
32
applications/test/maxMem/Test-maxMem.C
Normal file
@ -0,0 +1,32 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user