leakotron.vgtest leakotron.stdout.exp leakotron.stderr.exp \
long_namespace_xml.vgtest long_namespace_xml.stdout.exp \
long_namespace_xml.stderr.exp \
+ lsframe1.vgtest lsframe1.stdout.exp lsframe1.stderr.exp \
+ lsframe2.vgtest lsframe2.stdout.exp lsframe2.stderr.exp \
malloc_free_fill.vgtest malloc_free_fill.stdout.exp \
malloc_free_fill.stderr.exp-glibc25-amd64 \
malloc_free_fill.stderr.exp-glibc25-x86 \
fprw fwrite hello inits inline \
leak-0 leak-cycle leak-pool leak-tree leak-regroot leakotron \
long_namespace_xml \
+ lsframe1 lsframe2 \
malloc_free_fill \
malloc_usable malloc1 malloc2 malloc3 manuel1 manuel2 manuel3 \
match-overrun \
--- /dev/null
+
+/* 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;
+}
--- /dev/null
+
+lsframe1: start
+lsframe1: done, result is -8388608
+
+ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
+malloc/free: in use at exit: 0 bytes in 0 blocks.
+malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
+For a detailed leak analysis, rerun with: --leak-check=yes
+For counts of detected errors, rerun with: -v
--- /dev/null
+prog: lsframe1
+vgopts: --main-stacksize=67200000 --max-stackframe=67200000
--- /dev/null
+
+/* Demonstrate Memcheck correctly handling chain of 64 recursive
+ calls, each of which allocates a 1 M array on the stack. Requires
+ --main-stacksize=67117057 (on amd64-linux) or above, but works fine
+ if you specify that. */
+
+#include <stdio.h>
+
+#define N_MBYTES 64
+
+#define N_INTS_PER_MBYTE (1048576 / sizeof(int))
+
+int rec ( int depth )
+{
+ int i, zzz;
+ int arr[N_INTS_PER_MBYTE];
+ if (depth == 0) return 0;
+ for (i = 0; i < N_INTS_PER_MBYTE; i++)
+ arr[i] = i * depth;
+ zzz = rec(depth-1);
+ for (i = 0; i < N_INTS_PER_MBYTE; i++)
+ zzz += arr[i];
+ return zzz;
+}
+
+
+int main ( void )
+{
+ int sum;
+ fprintf(stderr, "lsframe2: start\n");
+ sum = rec(N_MBYTES);
+ fprintf(stderr, "lsframe2: done, result is %d\n", sum);
+ return 0;
+}
--- /dev/null
+
+lsframe2: start
+lsframe2: done, result is -272629760
+
+ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
+malloc/free: in use at exit: 0 bytes in 0 blocks.
+malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
+For a detailed leak analysis, rerun with: --leak-check=yes
+For counts of detected errors, rerun with: -v
--- /dev/null
+prog: lsframe2
+vgopts: --main-stacksize=68500000