]>
git.proxmox.com Git - rustc.git/blob - src/compiler-rt/test/asan/TestCases/Linux/print_memory_profile_test.cc
1 // Printing memory profiling only works in the configuration where we can
3 // REQUIRES: leak-detection
5 // RUN: %clangxx_asan %s -o %t
6 // RUN: %run %t 2>&1 | FileCheck %s
7 #include <sanitizer/common_interface_defs.h>
15 for (int i
= 0; i
< 17; i
++)
16 sink
[idx
++] = new char[131000];
17 for (int i
= 0; i
< 28; i
++)
18 sink
[idx
++] = new char[24000];
20 __sanitizer_print_memory_profile(100);
21 __sanitizer_print_memory_profile(50);
24 // CHECK: Live Heap Allocations: {{.*}}; showing top 100%
25 // CHECK: 2227000 byte(s) ({{.*}}%) in 17 allocation(s)
26 // CHECK: 672000 byte(s) ({{.*}}%) in 28 allocation(s)
27 // CHECK: Live Heap Allocations: {{.*}}; showing top 50%
28 // CHECK: 2227000 byte(s) ({{.*}}%) in 17 allocation(s)
29 // CHECK-NOT: 1008 byte