1 // RUN: %clang_msan -fsanitize-memory-track-origins=0 -O0 %s -o %t && env MSAN_OPTIONS=soft_rss_limit_mb=18:verbosity=1:allocator_may_return_null=1 %run %t 2>&1 | FileCheck %s -implicit-check-not="soft rss limit" -check-prefixes=CHECK,NOORIG
2 // RUN: %clang_msan -fsanitize-memory-track-origins=2 -O0 %s -o %t && env MSAN_OPTIONS=soft_rss_limit_mb=36:verbosity=1:allocator_may_return_null=1 %run %t 2>&1 | FileCheck %s -implicit-check-not="soft rss limit" -check-prefixes=CHECK,ORIGIN
5 #include <sanitizer/allocator_interface.h>
13 int main(int argc
, char **argv
) {
14 int s
= 20 * 1024 * 1024;
15 fprintf(stderr
, "malloc\n");
18 fprintf(stderr
, "memset\n");
21 fprintf(stderr
, "free\n");
27 // CHECK-LABEL: malloc
29 // Non origin mode allocate ~20M for shadow.
30 // Origin mode allocate ~20M for shadow and ~20M for origin.
31 // CHECK: soft rss limit exhausted
33 // CHECK-LABEL: memset
35 // Memset reserve modified pages, frees ~20M for shadow. So not change in RSS for non-origin mode.
36 // Origin mode also frees ~20M of origins, so 'unexhausted'.
37 // ORIGIN: soft rss limit unexhausted
41 // Now non-origin release all everything.
42 // NOORIG: soft rss limit unexhausted