Skip to content

Instantly share code, notes, and snippets.

@lesovsky
Created February 17, 2015 09:57
Show Gist options
  • Save lesovsky/3898e34b17f29b1bf9a8 to your computer and use it in GitHub Desktop.
Save lesovsky/3898e34b17f29b1bf9a8 to your computer and use it in GitHub Desktop.
OOM reproduce
#include <stdio.h>
#include <stdlib.h>
int main (void) {
int n = 0;
while (1) {
if (malloc(1<<20) == NULL) {
printf("malloc failure after %d MiB\n", n);
return 0;
}
printf ("got %d MiB\n", ++n);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment