Created
February 17, 2015 09:57
-
-
Save lesovsky/3898e34b17f29b1bf9a8 to your computer and use it in GitHub Desktop.
OOM reproduce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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