From: Richard M. Stallman Date: Mon, 3 Feb 1997 02:51:09 +0000 (+0000) Subject: (main): Don't extend stack limit too far. X-Git-Tag: emacs-20.1~2977 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=509a8fcde89b144b6638693f1bbeb854e7aa492c;p=emacs.git (main): Don't extend stack limit too far. --- diff --git a/src/emacs.c b/src/emacs.c index 7349a21698d..d98c30463f7 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -553,7 +553,14 @@ main (argc, argv, envp) /* Extend the stack space available. */ if (!getrlimit (RLIMIT_STACK, &rlim)) { - rlim.rlim_cur = rlim.rlim_max; + long newlim; + /* Approximate the amount regex.c needs, plus some more. */ + newlim = 800000 * sizeof (char *); + if (newlim > rlim.rlim_max) + newlim = rlim.rlim_max; + if (rlim.rlim_cur < newlim) + rlim.rlim_cur = newlim; + setrlimit (RLIMIT_STACK, &rlim); } #endif