diff options
-rw-r--r-- | guix-build-coordinator/utils.scm | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/guix-build-coordinator/utils.scm b/guix-build-coordinator/utils.scm index 1b7556e..c833183 100644 --- a/guix-build-coordinator/utils.scm +++ b/guix-build-coordinator/utils.scm @@ -262,8 +262,8 @@ upcoming chunk." (define* (make-chunked-output-port* port #:key (keep-alive? #f) (buffering 1200)) - (define initial-heap-size - (assq-ref (gc-stats) 'heap-size)) + (define heap-allocated-limit + (expt 2 20)) ;; 1MiB (define (%put-string s) (unless (string-null? s) @@ -279,13 +279,13 @@ upcoming chunk." (let* ((stats (gc-stats)) (initial-gc-times (assq-ref stats 'gc-times))) - (while (let ((updated-stats (gc-stats))) - (and (> (assq-ref updated-stats 'heap-allocated-since-gc) - initial-heap-size) - (= initial-gc-times - (assq-ref updated-stats 'gc-times)))) - (gc) - (usleep 10)))))) + (when (> (assq-ref stats 'heap-allocated-since-gc) + heap-allocated-limit) + (while (let ((updated-stats (gc-stats))) + (= (assq-ref updated-stats 'gc-times) + initial-gc-times)) + (gc) + (usleep 50))))))) (define (%put-char c) (%put-string (list->string (list c)))) |