Skip to content

Instantly share code, notes, and snippets.

@phil-lavin
Created June 11, 2015 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phil-lavin/920387019727f20b352a to your computer and use it in GitHub Desktop.
Save phil-lavin/920387019727f20b352a to your computer and use it in GitHub Desktop.
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
main() {
char *lots_of_memory;
int i;
printf("Allocating...\n");
lots_of_memory = malloc(2000000000);
printf("Filling...\n");
memset(lots_of_memory, 0, 2000000000);
printf("Looping...\n");
for (i = 0; i <= 30; i++) {
sleep(1);
}
free(lots_of_memory);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment