From 509a8fcde89b144b6638693f1bbeb854e7aa492c Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 3 Feb 1997 02:51:09 +0000 Subject: [PATCH] (main): Don't extend stack limit too far. --- src/emacs.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 -- 2.39.5