mirror of
https://github.com/ioacademy-jikim/debugging
synced 2025-06-08 08:26:14 +00:00
27 lines
612 B
C
27 lines
612 B
C
|
|
/* Demonstrate Memcheck correctly handling a 64M array on the stack.
|
|
Requires --max-stackframe=67108884 or above. And since it
|
|
generates a very large stack, --main-stacksize=67200000
|
|
(approximately) is also required. */
|
|
|
|
#include <stdio.h>
|
|
|
|
#define N_MBYTES 64
|
|
|
|
#define N_INTS ((N_MBYTES * 1048576) / sizeof(int))
|
|
|
|
|
|
int main ( void )
|
|
{
|
|
int i, sum;
|
|
int arr[N_INTS];
|
|
fprintf(stderr, "lsframe1: start\n");
|
|
for (i = 0; i < N_INTS; i++)
|
|
arr[i] = i;
|
|
sum = 0;
|
|
for (i = 0; i < N_INTS; i++)
|
|
sum += arr[i];
|
|
fprintf(stderr, "lsframe1: done, result is %d\n", sum);
|
|
return 0;
|
|
}
|