Use a dedicated fiber for heap size monitoring

This commit is contained in:
Christopher Baines 2024-10-27 13:55:16 +00:00
parent 46b86761f5
commit f1071cbd4d

View file

@ -614,12 +614,6 @@
'(define unsupported-cross-compilation-target-error? (const #f)) '(define unsupported-cross-compilation-target-error? (const #f))
inf)) inf))
(format (current-error-port)
"heap size: ~a MiB~%"
(round
(/ (assoc-ref (gc-stats) 'heap-size)
(expt 2. 20))))
(catch (catch
'match-error 'match-error
(lambda () (lambda ()
@ -2588,6 +2582,23 @@ SKIP LOCKED")
(exec-query conn "BEGIN") (exec-query conn "BEGIN")
(spawn-fiber
(lambda ()
(while #t
(sleep 30)
(let ((stats (gc-stats)))
(simple-format
(current-error-port)
"process-job heap: ~a MiB used (~a MiB heap)~%"
(round
(/ (- (assoc-ref stats 'heap-size)
(assoc-ref stats 'heap-free-size))
(expt 2. 20)))
(round
(/ (assoc-ref stats 'heap-size)
(expt 2. 20))))))))
(match (select-job-for-update conn id) (match (select-job-for-update conn id)
(((id commit source git-repository-id)) (((id commit source git-repository-id))