Typo in NEWS
[valgrind.git] / massif / tests / ignored.c
blob8b1bf08ca5bd2310c52f28bf0107c20ba51d9dd7
1 #include <stdlib.h>
3 // All sizes are divisible by 16 -- no slop.
5 int* ignore1(void)
7 // Allocating/freeing in an ignored function: ignored.
8 int* ignored_x1 = malloc(400);
9 int* ignored_x2 = malloc(400);
10 free(ignored_x2);
11 return ignored_x1;
14 void ignore2(int* x, int* ignored_x)
16 // Growing/shrinking a non-ignored block in an ignored function: ignored.
17 x = realloc(x, 800);
18 x = realloc(x, 400);
20 // Growing/shrinking an ignored block in an ignored function: ignored.
21 ignored_x = realloc(ignored_x, 800);
22 ignored_x = realloc(ignored_x, 400);
25 int main(void)
27 int* x;
28 int* ignored_x;
30 // Not ignored.
31 x = malloc(400);
33 // Get an ignored block.
34 ignored_x = ignore1();
36 // Growing/shrinking a non-ignored block in a non-ignored function:
37 // not ignored.
38 x = realloc(x, 800);
39 x = realloc(x, 400);
41 // Growing/shrinking an ignored block in a non-ignored function: ignored.
42 ignored_x = realloc(ignored_x, 800);
43 ignored_x = realloc(ignored_x, 400);
45 ignore2(x, ignored_x);
47 x = realloc(ignored_x, 0); // equivalent to 'free(ignored_x)'.
49 return 0;