Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / asan / TestCases / Linux / auto_memory_profile_test.cpp
blob3f8ad4673e756de979bb13b5ff4dcd0707f06adb
1 // Tests heap_profile=1.
2 // Printing memory profiling only works in the configuration where we can
3 // detect leaks.
4 // REQUIRES: leak-detection
5 //
6 // RUN: %clangxx_asan %s -o %t
7 // RUN: %env_asan_opts=heap_profile=1 %run %t 2>&1 | FileCheck %s
8 #include <sanitizer/common_interface_defs.h>
10 #include <stdio.h>
11 #include <string.h>
12 #include <unistd.h>
14 char *sink[1000];
16 int main() {
18 for (int i = 0; i < 3; i++) {
19 const size_t kSize = 13000000;
20 char *x = new char[kSize];
21 memset(x, 0, kSize);
22 sink[i] = x;
23 sleep(1);
27 // CHECK: HEAP PROFILE at RSS
28 // CHECK: 13000000 byte(s)
29 // CHECK: HEAP PROFILE at RSS
30 // CHECK: 26000000 byte(s)
31 // CHECK: HEAP PROFILE at RSS
32 // CHECK: 39000000 byte(s)