1 // Test the mmap_limit_mb flag.
3 // RUN: %clangxx_asan -std=c++11 -O2 %s -o %t
6 // RUN: ASAN_OPTIONS=mmap_limit_mb=500 %t 100 16
7 // RUN: ASAN_OPTIONS=mmap_limit_mb=500 %t 100 1000000
8 // RUN: ASAN_OPTIONS=mmap_limit_mb=500 not %t 500 16 2>&1 | FileCheck %s
9 // RUN: ASAN_OPTIONS=mmap_limit_mb=500 not %t 500 1000000 2>&1 | FileCheck %s
18 int main(int argc
, char **argv
) {
20 long total_mb
= atoi(argv
[1]);
21 long allocation_size
= atoi(argv
[2]);
22 std::vector
<char *> v
;
23 for (long total
= total_mb
<< 20; total
> 0; total
-= allocation_size
)
24 v
.push_back(new char[allocation_size
]);
25 for (auto p
: v
) delete[] p
;
27 // CHECK: AddressSanitizer CHECK failed{{.*}}total_mmaped{{.*}}mmap_limit_mb