Advertisement
Guest User

Untitled

a guest
May 27th, 2015
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. /**
  2. * allocbot.c - mindlessly allocate memory
  3. *
  4. * Florian Dejonckheere <florian@floriandejonckheere.be
  5. *
  6. * */
  7.  
  8. #include <stdio.h>
  9. #include <unistd.h>
  10. #include <stdlib.h>
  11. #include <strings.h>
  12.  
  13. #define ALLOC (10 * 1024 * 1024)
  14.  
  15. void main() {
  16. while(1) {
  17. // Allocate 10 MiB
  18. void *ptr = malloc(ALLOC);
  19. bzero(ptr, ALLOC);
  20. printf("Allocated 10 MiB\n");
  21. usleep(100000);
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement