ebruakagunduz

400mb_memory

Jan 7th, 2015
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main() {
  5. int i, k;
  6. int p;
  7. int *a = malloc(409600000);
  8. int *buf;
  9. int j = 0;
  10.  
  11. for (i = 0; i < 5000; i++) {
  12. for (k = 0; k < 19; k++) {
  13. a[j] = 1;
  14. // *buf = a[j];
  15. printf("%p\n", buf);
  16. j += 1024;
  17. }
  18. j += 1024;
  19. *buf = a[j];
  20. printf("%p\n", buf);
  21. }
  22.  
  23. printf("Pages allocated.\n");
  24. getchar();
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment