From 0d22551a6bd7920e6dbebebcbf5d83842c248915 Mon Sep 17 00:00:00 2001 From: Werner Saar Date: Fri, 20 Nov 2015 09:23:01 +0100 Subject: [PATCH] increase the stack size limit in the constructor --- driver/others/memory.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/driver/others/memory.c b/driver/others/memory.c index 3d83a4037..af7bd81ce 100644 --- a/driver/others/memory.c +++ b/driver/others/memory.c @@ -104,6 +104,8 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include +#include #endif #if defined(OS_FREEBSD) || defined(OS_DARWIN) @@ -1361,6 +1363,18 @@ void CONSTRUCTOR gotoblas_init(void) { gotoblas_memory_init(); #endif +#if defined(OS_LINUX) + struct rlimit curlimit; + if ( getrlimit(RLIMIT_STACK, &curlimit ) == 0 ) + { + if ( curlimit.rlim_cur != curlimit.rlim_max ) + { + curlimit.rlim_cur = curlimit.rlim_max; + setrlimit(RLIMIT_STACK, &curlimit); + } + } +#endif + #ifdef SMP if (blas_cpu_number == 0) blas_get_cpu_number(); #ifdef SMP_SERVER