Guest User

Untitled

a guest
Jul 18th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <unistd.h>
  4.  
  5. #define GIGABYTE 1024*1024*1024
  6.  
  7. int main(int argc, char *argv[])
  8. {
  9. void *myblock = NULL;
  10. int count = 0;
  11.  
  12. for(count = 1; count < 17; count++)
  13. {
  14. myblock = (void *) malloc(GIGABYTE);
  15. if (!myblock) break;
  16. memset(myblock,1, GIGABYTE);
  17. printf("Currently allocating %d GB\n", count);
  18. }
  19.  
  20. while (1)
  21. {
  22. sleep(10);
  23. }
  24. }
Add Comment
Please, Sign In to add comment