diff options
author | Jonas Hahnfeld <hahnjo@hahnjo.de> | 2018-01-01 18:19:06 +0000 |
---|---|---|
committer | Jonas Hahnfeld <hahnjo@hahnjo.de> | 2018-01-01 18:19:06 +0000 |
commit | 0f9768dcefd336508539249d11b2631e6665cbc5 (patch) | |
tree | 17e8b4ba6674170a35c759b7d23bfe80d56e9049 /compiler-rt | |
parent | f13a514f082643305a9ddca88952cddeba2edaaf (diff) | |
download | llvm-0f9768dcefd336508539249d11b2631e6665cbc5.zip llvm-0f9768dcefd336508539249d11b2631e6665cbc5.tar.gz llvm-0f9768dcefd336508539249d11b2631e6665cbc5.tar.bz2 |
[scudo] Touch memory to count as RSS
This should fix the test from https://reviews.llvm.org/D41128.
Differential Revision: https://reviews.llvm.org/D41649
llvm-svn: 321627
Diffstat (limited to 'compiler-rt')
-rw-r--r-- | compiler-rt/test/scudo/interface.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/compiler-rt/test/scudo/interface.cpp b/compiler-rt/test/scudo/interface.cpp index 73ea0a7..ec73751 100644 --- a/compiler-rt/test/scudo/interface.cpp +++ b/compiler-rt/test/scudo/interface.cpp @@ -4,7 +4,6 @@ // RUN: %run %t heap-size 2>&1 // RUN: %env_scudo_opts="allocator_may_return_null=1" %run %t soft-limit 2>&1 // RUN: %env_scudo_opts="allocator_may_return_null=1" not %run %t hard-limit 2>&1 -// UNSUPPORTED: armhf-linux // Tests that the sanitizer interface functions behave appropriately. @@ -51,8 +50,11 @@ int main(int argc, char **argv) // Verifies that setting the soft RSS limit at runtime works as expected. std::vector<void *> pointers; size_t size = 1 << 19; // 512Kb - for (int i = 0; i < 5; i++) - pointers.push_back(malloc(size)); + for (int i = 0; i < 5; i++) { + void *p = malloc(size); + memset(p, 0, size); + pointers.push_back(p); + } // Set the soft RSS limit to 1Mb. __scudo_set_rss_limit(1, 0); usleep(20000); @@ -74,8 +76,11 @@ int main(int argc, char **argv) // Verifies that setting the hard RSS limit at runtime works as expected. std::vector<void *> pointers; size_t size = 1 << 19; // 512Kb - for (int i = 0; i < 5; i++) - pointers.push_back(malloc(size)); + for (int i = 0; i < 5; i++) { + void *p = malloc(size); + memset(p, 0, size); + pointers.push_back(p); + } // Set the hard RSS limit to 1Mb __scudo_set_rss_limit(1, 1); usleep(20000); |