1 2 /* Demonstrate Memcheck correctly handling a 64M array on the stack. 3 Requires --max-stackframe=67108884 or above. And since it 4 generates a very large stack, --main-stacksize=67200000 5 (approximately) is also required. */ 6 7 #include <stdio.h> 8 9 #define N_MBYTES 64 10 11 #define N_INTS ((N_MBYTES * 1048576) / sizeof(int)) 12 13 14 int main ( void ) 15 { 16 int i, sum; 17 int arr[N_INTS]; 18 fprintf(stderr, "lsframe1: start\n"); 19 for (i = 0; i < N_INTS; i++) 20 arr[i] = i; 21 sum = 0; 22 for (i = 0; i < N_INTS; i++) 23 sum += arr[i]; 24 fprintf(stderr, "lsframe1: done, result is %d\n", sum); 25 return 0; 26 } 27