Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- #define GIGABYTE 1024*1024*1024
- int main(int argc, char *argv[])
- {
- void *myblock = NULL;
- int count = 0;
- for(count = 1; count < 17; count++)
- {
- myblock = (void *) malloc(GIGABYTE);
- if (!myblock) break;
- memset(myblock,1, GIGABYTE);
- printf("Currently allocating %d GB\n", count);
- }
- while (1)
- {
- sleep(10);
- }
- }
Add Comment
Please, Sign In to add comment