Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <string.h>
- #include <stdio.h>
- #define GB 9
- int main(void) {
- const int allocsize = 1024 * 1024;
- const long long target = 1024LL * 1024 * 1024 * GB;
- for (long long i = 0; i < target; i += allocsize) {
- int *p = malloc(allocsize);
- if (p == NULL) {
- perror("malloc");
- return 1;
- }
- for (int i = 0; i < allocsize / sizeof(int); ++i)
- p[i] = rand();
- }
- printf("Done\n");
- char c;
- scanf("%c\n", &c);
- }
Advertisement
Add Comment
Please, Sign In to add comment