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
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);
};