Skip to content

Commit ae11b32

Browse files
trflynn89linusg
authored andcommitted
Do not set address space limit on macOS
First, macOS no longer respects this resource limit anyways (I was not able to find a primary source, but see: https://crbug.com/853873). More critically, our setrlimit invocation results in an exception raised with EINVAL on macOS. Even in C++, the following fails: struct rlimit rl; rl.rlim_cur = 512 * 1024 * 1024; rl.rlim_max = RLIM_INFINITY; int result = setrlimit(RLIMIT_AS, &rl); // result == EINVAL Resource limits seem to be non-functional on macOS in general; some even require recompiling Python from source to change the limits: https://bugs.python.org/issue40518
1 parent 094306e commit ae11b32

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

main.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import json
1515
import multiprocessing
1616
import os
17+
import platform
1718
import resource
1819
import signal
1920
import subprocess
@@ -82,9 +83,10 @@ def run_streaming_script(
8283
test_file_paths: list[Path],
8384
) -> subprocess.CompletedProcess:
8485
def limit_memory():
85-
resource.setrlimit(
86-
resource.RLIMIT_AS, (memory_limit * 1024 * 1024, resource.RLIM_INFINITY)
87-
)
86+
if platform.system() != "Darwin":
87+
resource.setrlimit(
88+
resource.RLIMIT_AS, (memory_limit * 1024 * 1024, resource.RLIM_INFINITY)
89+
)
8890

8991
command = [
9092
str(libjs_test262_runner),

0 commit comments

Comments
 (0)