ebruakagunduz

read-only pages

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