mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-17 09:10:22 +02:00
no hard-coded stack limitations if the user has getrlimit
* libguile/debug.c (init_stack_limit): Instead of "1 MB or 80% of rlimit, whichever is lower", just use 80% of the rlimit, if set.
This commit is contained in:
parent
a44c43368b
commit
6f36dbbe48
1 changed files with 4 additions and 14 deletions
|
@ -525,24 +525,14 @@ init_stack_limit (void)
|
||||||
struct rlimit lim;
|
struct rlimit lim;
|
||||||
if (getrlimit (RLIMIT_STACK, &lim) == 0)
|
if (getrlimit (RLIMIT_STACK, &lim) == 0)
|
||||||
{
|
{
|
||||||
int bytes = lim.rlim_cur, words;
|
rlim_t bytes = lim.rlim_cur;
|
||||||
|
|
||||||
/* set our internal stack limit to 1 MB or 80% of the rlimit, whichever
|
/* set our internal stack limit to 80% of the rlimit. */
|
||||||
is lower. */
|
|
||||||
if (bytes == RLIM_INFINITY)
|
if (bytes == RLIM_INFINITY)
|
||||||
bytes = lim.rlim_max;
|
bytes = lim.rlim_max;
|
||||||
|
|
||||||
if (bytes == RLIM_INFINITY)
|
if (bytes != RLIM_INFINITY)
|
||||||
words = 1024 * 1024 / sizeof (scm_t_bits);
|
SCM_STACK_LIMIT = bytes * 8 / 10 / sizeof (scm_t_bits);
|
||||||
else
|
|
||||||
{
|
|
||||||
bytes = bytes * 8 / 10;
|
|
||||||
if (bytes > 1024 * 1024)
|
|
||||||
bytes = 1024 * 1024;
|
|
||||||
words = bytes / sizeof (scm_t_bits);
|
|
||||||
}
|
|
||||||
|
|
||||||
SCM_STACK_LIMIT = words;
|
|
||||||
}
|
}
|
||||||
errno = 0;
|
errno = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue