1 // RUN: %clangxx_asan %s -o %t
2 // RUN: %env_asan_opts=quarantine_size_mb=2 %run %t 1
3 // RUN: %env_asan_opts=quarantine_size_mb=2 %run %t 4
6 #include <sanitizer/allocator_interface.h>
12 int main(int argc
, char **argv
) {
13 int s
= atoi(argv
[1]) * 1024 * 1024;
14 int a
= __sanitizer_get_heap_size();
16 int b
= __sanitizer_get_heap_size();
17 assert(b
- a
> s
/ 2);
19 int c
= __sanitizer_get_heap_size();
20 fprintf(stderr
, "%d %d\n", a
, c
);
21 if (atoi(argv
[1]) == 1)
22 assert(c
- a
> s
/ 2); // NODRAIN
24 assert(c
- a
< s
/ 2); // DRAIN