]>
git.proxmox.com Git - rustc.git/blob - src/compiler-rt/test/asan/TestCases/Posix/mmap_limit_mb.cc
1 // Test the mmap_limit_mb flag.
3 // RUN: %clangxx_asan -O2 %s -o %t
5 // RUN: %run %t 30 1000000
6 // RUN: %env_asan_opts=mmap_limit_mb=300 %run %t 20 16
7 // RUN: %env_asan_opts=mmap_limit_mb=300 %run %t 20 1000000
8 // RUN: %env_asan_opts=mmap_limit_mb=300 not %run %t 500 16 2>&1 | FileCheck %s
9 // RUN: %env_asan_opts=mmap_limit_mb=300 not %run %t 500 1000000 2>&1 | FileCheck %s
11 // FIXME: Windows doesn't implement mmap_limit_mb.
12 // XFAIL: arm-linux-gnueabi,win32
21 int main(int argc
, char **argv
) {
23 long total_mb
= atoi(argv
[1]);
24 long allocation_size
= atoi(argv
[2]);
25 fprintf(stderr
, "total_mb: %zd allocation_size: %zd\n", total_mb
,
27 std::vector
<char *> v
;
28 for (long total
= total_mb
<< 20; total
> 0; total
-= allocation_size
)
29 v
.push_back(new char[allocation_size
]);
30 for (std::vector
<char *>::const_iterator it
= v
.begin(); it
!= v
.end(); ++it
)
32 fprintf(stderr
, "PASS\n");
33 // CHECK: total_mmaped{{.*}}mmap_limit_mb