Add bug 494246 to NEWS
[valgrind.git] / massif / tests / ignoring.c
blobf57630c25761d1b76fb44e74aa3433d68038e865
1 // When we cull and compute the new minimum time between snapshots, we want
2 // to ignore any gap between two uncullable snapshots, because it is not
3 // representative. This program tests that.
6 #include <stdlib.h>
8 int main(void)
10 int i;
12 // The peak is from the first allocation.
13 int* x = malloc(1024);
14 free(x);
16 // Now do an allocation to provide the post-peak baseline.
17 malloc(512);
19 // Now we do lots of allocations below the peak. With the proper
20 // handling, the allocations should still be smoothly distributed.
21 // Without it, the snapshots in the second half of the graph would be
22 // clustered much more closely than those in the first half.
25 for (i = 0; i < 350; i++) {
26 int* y = malloc(256);
27 free(y);
30 return 0;