1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include<stdio.h> #include<stdlib.h> #define BLOCK_SIZE 4096 #define LIMIT 104857600 int main() { int count = 0; while(count < LIMIT && malloc(BLOCK_SIZE)) { count += BLOCK_SIZE; } printf("%d allocated\n", count); return 0; }