• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_esan_wset -O0 %s -o %t 2>&1
2 // RUN: %run %t 2>&1 | FileCheck %s
3 
4 #include <stdlib.h>
5 #include <string.h>
6 #include <sys/mman.h>
7 #include <assert.h>
8 #include <string.h>
9 
main(int argc,char ** argv)10 int main(int argc, char **argv) {
11   const int size = 128*1024*1024;
12   char *p = (char *)mmap(0, size, PROT_READ | PROT_WRITE,
13                          MAP_ANON | MAP_PRIVATE, -1, 0);
14   // Test the slowpath at different cache line boundaries.
15   for (int i = 0; i < 630; i++)
16     memset((char *)p + 63*i, i, 63*i);
17   munmap(p, size);
18   return 0;
19   // CHECK: {{.*}} EfficiencySanitizer: the total working set size: 77 KB (12{{[0-9]+}} cache lines)
20 }
21