1 // Test max_redzone runtime option.
3 // RUN: %clangxx_asan -O0 %s -o %t && %env_asan_opts=max_redzone=32 %run %t 0 2>&1
4 // RUN: %clangxx_asan -O0 %s -o %t && %run %t 1 2>&1
5 // RUN: %clangxx_asan -O3 %s -o %t && %env_asan_opts=max_redzone=32 %run %t 0 2>&1
6 // RUN: %clangxx_asan -O3 %s -o %t && %run %t 1 2>&1
11 #include <sanitizer/allocator_interface.h>
13 int main(int argc
, char **argv
) {
16 bool large_redzone
= atoi(argv
[1]);
17 size_t before
= __sanitizer_get_heap_size();
19 for (int i
= 0; i
< 10000; ++i
)
20 pp
[i
] = malloc(4096 - 64);
21 size_t after
= __sanitizer_get_heap_size();
22 for (int i
= 0; i
< 10000; ++i
)
24 size_t diff
= after
- before
;
25 return !(large_redzone
? diff
> 46000000 : diff
< 46000000);