Test-malloc.C
Go to the documentation of this file.
1 #include "stream.h"
2 #include <unistd.h>
3 #include <stdlib.h>
4 
5 main()
6 {
7  int *ptrs[500000];
8 
9  cerr << "allocating ints\n";
10 
11  for (int i=0; i<500000; i++)
12  {
13  ptrs[i] = (int*)malloc(sizeof(int));
14  }
15 
16 // for (;;);
17 
18  cerr << "deallocating ints\n";
19 
20  for (i=0; i<500000; i++)
21  {
22  free(ptrs[i]);
23  }
24 
25  cerr << "allocating double\n";
26 
27  double* array = (double*)malloc(500000*sizeof(double));
28 
29  for (;;);
30 }
main
main()
Definition: Test-malloc.C:5