Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #define ARRAY_SIZE 1024
- #define ELEMENT_SIZE 1<<30 // 1GB
- int main() {
- void* ptr[ARRAY_SIZE];
- for (int i = 0; i < ARRAY_SIZE; i++) {
- ptr[i] = malloc(ELEMENT_SIZE);
- if (ptr[i] == NULL) {
- printf("Allocation failed\n");
- break;
- }
- }
- printf("Allocation finished\n");
- getc(stdin);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement