Guest User

Untitled

a guest
Nov 21st, 2026
14
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <string.h>
  3. #include <stdio.h>
  4.  
  5. #define GB 9
  6.  
  7. int main(void) {
  8. const int allocsize = 1024 * 1024;
  9. const long long target = 1024LL * 1024 * 1024 * GB;
  10. for (long long i = 0; i < target; i += allocsize) {
  11. int *p = malloc(allocsize);
  12. if (p == NULL) {
  13. perror("malloc");
  14. return 1;
  15. }
  16. for (int i = 0; i < allocsize / sizeof(int); ++i)
  17. p[i] = rand();
  18. }
  19. printf("Done\n");
  20. char c;
  21. scanf("%c\n", &c);
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment