ATTENTION! This is just for testing purposes. The two files try different approaches to store endless data in the memory. This experiment shows how the computer behaves in edge cases.
Created
January 5, 2018 09:33
-
-
Save xremix/a0f4c8262e252fb30bf5f777a7d84300 to your computer and use it in GitHub Desktop.
MemBlower
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(int argc, char const *argv[]) | |
{ | |
long* p; | |
// for (int i = 0; i < 2; ++i) | |
for (int i = 0; i < 100000000000; ++i) | |
{ | |
p = malloc(2048); | |
} | |
printf("End"); | |
return 0; | |
} |
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(int argc, char const *argv[]) | |
{ | |
int a; | |
printf("Please input an integer value: "); | |
scanf("%d", &a); | |
long* p[1010000]; | |
// for (int i = 0; i < 2; ++i) | |
for (int i = 0; i < 1010000; ++i) | |
{ | |
p[i] = malloc(1024*1000); | |
*p[i] = (*p[i]); | |
// printf("x"); | |
} | |
printf("End"); | |
printf("Please input an integer value: "); | |
scanf("%d", &a); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment