diff options
author | Andy Wingo <wingo@pobox.com> | 2009-04-03 10:38:30 -0700 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2009-04-03 10:38:30 -0700 |
commit | 6f36dbbe48506eccfc6a1df7d626dfe94ba3f696 (patch) | |
tree | 64d275db946e2ba38f6ec202453da722256bbda8 /libguile/debug.c | |
parent | a44c43368b5a6c423e0498b6df734b969df2fdde (diff) | |
download | guile-6f36dbbe48506eccfc6a1df7d626dfe94ba3f696.tar.gz |
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.
Diffstat (limited to 'libguile/debug.c')
-rw-r--r-- | libguile/debug.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/libguile/debug.c b/libguile/debug.c index ec37d3aaa..20c8d4e6b 100644 --- a/libguile/debug.c +++ b/libguile/debug.c @@ -525,24 +525,14 @@ init_stack_limit (void) struct rlimit lim; 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 - is lower. */ + /* set our internal stack limit to 80% of the rlimit. */ if (bytes == RLIM_INFINITY) bytes = lim.rlim_max; - if (bytes == RLIM_INFINITY) - words = 1024 * 1024 / 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; + if (bytes != RLIM_INFINITY) + SCM_STACK_LIMIT = bytes * 8 / 10 / sizeof (scm_t_bits); } errno = 0; #endif |