Stop trying to setrlimit(RLIMIT_AS) in ASAN builds
authorYedidya Feldblum <yfeldblum@fb.com>
Sat, 6 May 2017 00:14:26 +0000 (17:14 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Sat, 6 May 2017 04:54:27 +0000 (21:54 -0700)
Summary:
[Folly] Stop trying to `setrlimit(RLIMIT_AS)` in ASAN builds.

ASAN needs to reserve plenty of memory outside of the limited address space imposed by the call to `setrlimit`.

Reviewed By: andriigrynenko

Differential Revision: D5014679

fbshipit-source-id: 2ab71b1cca9297d3a276cf72154fac30a2057f86

folly/futures/test/RetryingTest.cpp

index 43a15ea2221754cdaec099821e8e061600fb5bab..2ec569fa2169826f08fd87eb0bb63750fe607766 100644 (file)
@@ -146,7 +146,9 @@ TEST(RetryingTest, large_retries) {
   rlimit newMemLimit;
   newMemLimit.rlim_cur = std::min(1UL << 30, oldMemLimit.rlim_max);
   newMemLimit.rlim_max = oldMemLimit.rlim_max;
-  PCHECK(setrlimit(RLIMIT_AS, &newMemLimit) == 0);
+  if (!folly::kIsSanitizeAddress) { // ASAN reserves outside of the rlimit
+    PCHECK(setrlimit(RLIMIT_AS, &newMemLimit) == 0);
+  }
   SCOPE_EXIT {
     PCHECK(setrlimit(RLIMIT_AS, &oldMemLimit) == 0);
   };