Limit stack size to 16 MB on Darwin
authorClifford Wolf <clifford@clifford.at>
Wed, 7 Nov 2018 14:32:34 +0000 (15:32 +0100)
committerClifford Wolf <clifford@clifford.at>
Wed, 7 Nov 2018 14:32:34 +0000 (15:32 +0100)
Signed-off-by: Clifford Wolf <clifford@clifford.at>
backends/smt2/smtio.py

index 108f6bcfed9ed2052b31eea6df3877826f90ca76..afbcf1fc4111cacf6b1be7992625a36954fa3388 100644 (file)
@@ -34,9 +34,12 @@ if os.name == "posix":
     if sys.getrecursionlimit() < smtio_reclimit:
         sys.setrecursionlimit(smtio_reclimit)
 
-    smtio_stacksize = 128 * 1024 * 1024
     current_rlimit_stack = resource.getrlimit(resource.RLIMIT_STACK)
     if current_rlimit_stack[0] != resource.RLIM_INFINITY:
+        smtio_stacksize = 128 * 1024 * 1024
+        if os.uname().sysname == "Darwin":
+            # MacOS has rather conservative stack limits
+            smtio_stacksize = 16 * 1024 * 1024
         if current_rlimit_stack[1] != resource.RLIM_INFINITY:
             smtio_stacksize = min(smtio_stacksize, current_rlimit_stack[1])
         if current_rlimit_stack[0] < smtio_stacksize: