1 // RUN: %clangxx_memprof  %s -o %t
2 
3 // RUN: %env_memprof_opts=log_path=stdout %run %t | FileCheck %s
4 
5 #include <sanitizer/memprof_interface.h>
6 #include <stdlib.h>
7 #include <string.h>
8 int main(int argc, char **argv) {
9   char *x = (char *)malloc(10);
10   memset(x, 0, 10);
11   free(x);
12   __memprof_profile_dump();
13   x = (char *)malloc(10);
14   memset(x, 0, 10);
15   free(x);
16   return 0;
17 }
18 // We should get 2 rounds of profile info, one from the explicit dump request,
19 // and one at exit.
20 // CHECK: Memory allocation stack id
21 // CHECK: Stack for id
22 // CHECK: Memory allocation stack id
23 // CHECK: Stack for id
24