1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <math.h>

int main() {
  int no_of_GB = 20;
  uint64_t memsize = no_of_GB * pow(2,30);
  int sleeptime = 600;
  uint64_t i;

  printf ("Allocating %d GB (%llu bytes) of memory...\n", no_of_GB, memsize);
  char *my_string = malloc(memsize);

  for (i = 0; i < memsize; i++) {
    my_string[i] = 'a';
  }

  printf ("Sleeping %d seconds...\n", sleeptime);

  sleep(600);

}