From da71d5ee0157b2c5d521e13b90139d4c3e7c68d8 Mon Sep 17 00:00:00 2001 From: Ken McMillan Date: Fri, 24 Oct 2014 11:53:03 -0700 Subject: [PATCH] unlimit stack on linux/mac --- src/interp/iz3interp.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/interp/iz3interp.cpp b/src/interp/iz3interp.cpp index 0d394090f..7a0090981 100755 --- a/src/interp/iz3interp.cpp +++ b/src/interp/iz3interp.cpp @@ -513,3 +513,26 @@ void interpolation_options_struct::apply(iz3base &b){ b.set_option((*it).first,(*it).second); } +// On linux and mac, unlimit stack space so we get recursion + +#if defined(_WINDOWS) || defined(_CYGWIN) + +#else + +#include +#include + +class iz3stack_unlimiter { +public: + iz3stack_unlimiter() { + struct rlimit rl = {RLIM_INFINITY, RLIM_INFINITY}; + setrlimit(RLIMIT_STACK, &rl); + // nothing to be done if above fails + } +}; + +// initializing this will unlimit stack + +iz3stack_unlimiter the_iz3stack_unlimiter; + +#endif