brintos

brintos / llvm-project-archived public Read only

0
0
Text · 705 B · ee7f1ad Raw
25 lines · cpp
1// RUN: %clangxx_memprof  %s -o %t2 3// RUN: %env_memprof_opts=print_text=true:log_path=stdout %run %t | FileCheck %s4 5#include <sanitizer/memprof_interface.h>6#include <stdlib.h>7#include <string.h>8int main(int argc, char **argv) {9  for (int i = 0; i < 3; i++) {10    char *x = (char *)malloc(10);11    if (i % 2)12      memset(x, 0, 10);13    else14      memset(x, 2, 10);15    free(x);16  }17  return 0;18}19// We should get one allocation site with alloc_count = loop trip count = 320// CHECK: Memory allocation stack id = [[ID:[0-9]+]]21// CHECK-NEXT-COUNT-1: alloc_count 322// CHECK-COUNT-1: Stack for id {{.*}}[[ID]]23// CHECK-NEXT-COUNT-1: memprof_malloc_linux.cpp24// CHECK-NEXT-COUNT-1: memprof_merge_mib.cpp25