diff --git a/collects/tests/racket/long-cmdline.rkt b/collects/tests/racket/long-cmdline.rkt new file mode 100644 index 0000000000..ced5a24d47 --- /dev/null +++ b/collects/tests/racket/long-cmdline.rkt @@ -0,0 +1,9 @@ +#lang racket/base +(require racket/system) + +(let ([p (find-executable-path (find-system-path 'exec-file))]) + (let ([s (open-output-bytes)]) + (parameterize ([current-output-port s]) + (apply system* p "-e" "'done" (for/list ([i 8192]) "x"))) + (unless (equal? (get-output-bytes s) #"'done\n") + (error "test failed")))) diff --git a/src/racket/gc2/mem_account.c b/src/racket/gc2/mem_account.c index 8e21d0e31a..9516c46fbc 100644 --- a/src/racket/gc2/mem_account.c +++ b/src/racket/gc2/mem_account.c @@ -622,7 +622,11 @@ int BTC_single_allocation_limit(NewGC *gc, size_t sizeb) { * is much smaller than the actual available memory, and as long as * GC_out_of_memory protects any user-requested allocation whose size * is independent of any existing object, then we can enforce the limit. */ - return (custodian_single_time_limit(gc, thread_get_owner(scheme_current_thread)) < sizeb); + Scheme_Thread *p = scheme_current_thread; + if (p) + return (custodian_single_time_limit(gc, thread_get_owner(p)) < sizeb); + else + return 0; } static inline void BTC_clean_up(NewGC *gc) {