Use conservative stack size for SMT2 on MacOS

This commit is contained in:
Arjen Roodselaar 2018-11-04 21:58:09 -08:00
parent 36ea98385f
commit 2b93542171
1 changed files with 6 additions and 1 deletions

View File

@ -32,10 +32,15 @@ from threading import Thread
if os.name == "posix":
smtio_reclimit = 64 * 1024
smtio_stacksize = 128 * 1024 * 1024
smtio_stacklimit = resource.RLIM_INFINITY
if os.uname().sysname == "Darwin":
# MacOS has rather conservative stack limits
smtio_stacksize = 16 * 1024 * 1024
smtio_stacklimit = resource.getrlimit(resource.RLIMIT_STACK)[1]
if sys.getrecursionlimit() < smtio_reclimit:
sys.setrecursionlimit(smtio_reclimit)
if resource.getrlimit(resource.RLIMIT_STACK)[0] < smtio_stacksize:
resource.setrlimit(resource.RLIMIT_STACK, (smtio_stacksize, -1))
resource.setrlimit(resource.RLIMIT_STACK, (smtio_stacksize, smtio_stacklimit))
# currently running solvers (so we can kill them)