summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gc.c2
-rw-r--r--tests/012/stack.tl15
2 files changed, 10 insertions, 7 deletions
diff --git a/gc.c b/gc.c
index 4b7c0a8c..ee47f054 100644
--- a/gc.c
+++ b/gc.c
@@ -896,7 +896,7 @@ void gc_init(val *stack_bottom)
#if HAVE_RLIMIT
struct rlimit rl;
if (getrlimit(RLIMIT_STACK, &rl) == 0) {
- if (rl.rlim_cur > 512 * 1024) {
+ if (rl.rlim_cur != RLIM_INFINITY && rl.rlim_cur > 512 * 1024) {
rlim_t lim = (rl.rlim_cur - rl.rlim_cur / 16) / sizeof (val);
gc_stack_limit = gc_stack_bottom - lim;
}
diff --git a/tests/012/stack.tl b/tests/012/stack.tl
index 879d3d27..9a7534bb 100644
--- a/tests/012/stack.tl
+++ b/tests/012/stack.tl
@@ -1,5 +1,7 @@
(load "../common")
+(defvar stack-limited (set-stack-limit 32768))
+
(defun recur () (recur))
(defmacro so (expr)
@@ -8,12 +10,13 @@
(test (so (recur)) :so)
-(test (let ((pid (fork)))
- (cond
- ((zerop pid) (set-stack-limit 0) (recur))
- (t (let ((status (wait pid)))
- (w-ifsignaled status)))))
- t)
+(if stack-limited
+ (test (let ((pid (fork)))
+ (cond
+ ((zerop pid) (set-stack-limit 0) (recur))
+ (t (let ((status (wait pid)))
+ (w-ifsignaled status)))))
+ t))
(defmacro infexp ()
^(foo (infexp)))