openfoam/applications/test/alloc/Test-malloc.C
Mark Olesen f3670521cd STYLE: use std:: qualifier on ::abort, ::exit
- consistent with use of <cstdlib> and makes for a stronger distinct
  from Foam::abort etc.
2019-04-03 20:24:30 +02:00

31 lines
449 B
C

#include "stream.h"
#include <unistd.h>
#include <cstdlib>
main()
{
int *ptrs[500000];
cerr << "allocating ints\n";
for (int i=0; i<500000; i++)
{
ptrs[i] = (int*)malloc(sizeof(int));
}
// for (;;);
cerr << "deallocating ints\n";
for (i=0; i<500000; i++)
{
free(ptrs[i]);
}
cerr << "allocating double\n";
double* array = (double*)malloc(500000*sizeof(double));
for (;;);
}