blob: f57630c25761d1b76fb44e74aa3433d68038e865 [file] [log] [blame]
njn734b8052007-11-01 04:40:37 +00001// 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.
4
5
6#include <stdlib.h>
7
8int main(void)
9{
10 int i;
11
12 // The peak is from the first allocation.
njn32397c02007-11-10 04:08:08 +000013 int* x = malloc(1024);
njn734b8052007-11-01 04:40:37 +000014 free(x);
15
16 // Now do an allocation to provide the post-peak baseline.
njn32397c02007-11-10 04:08:08 +000017 malloc(512);
njn734b8052007-11-01 04:40:37 +000018
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.
23 //
24
25 for (i = 0; i < 350; i++) {
njn32397c02007-11-10 04:08:08 +000026 int* y = malloc(256);
njn734b8052007-11-01 04:40:37 +000027 free(y);
28 }
29
30 return 0;
31}